728x90
Vertical Bar With Labels Demo
From ZedGraphWiki
NOTE: The code on this page is for ZedGraph version 5. You can view the code for version 4 here.
// Call this method from the Form_Load method, passing your ZedGraphControl public void CreateChart( ZedGraphControl zgc ) { GraphPane myPane = zgc.GraphPane; // Set the title and axis labels myPane.Title.Text = "Vertical Bars with Value Labels Above Each Bar"; myPane.XAxis.Title.Text = "Position Number"; myPane.YAxis.Title.Text = "Some Random Thing"; PointPairList list = new PointPairList(); PointPairList list2 = new PointPairList(); PointPairList list3 = new PointPairList(); Random rand = new Random(); // Generate random data for three curves for ( int i=0; i<5; i++ ) { double x = (double) i; double y = rand.NextDouble() * 1000; double y2 = rand.NextDouble() * 1000; double y3 = rand.NextDouble() * 1000; list.Add( x, y ); list2.Add( x, y2 ); list3.Add( x, y3 ); } // create the curves BarItem myCurve = myPane.AddBar( "curve 1", list, Color.Blue ); BarItem myCurve2 = myPane.AddBar( "curve 2", list2, Color.Red ); BarItem myCurve3 = myPane.AddBar( "curve 3", list3, Color.Green ); // Fill the axis background with a color gradient myPane.Chart.Fill = new Fill( Color.White, Color.FromArgb( 255, 255, 166), 45.0F ); zgc.AxisChange(); // expand the range of the Y axis slightly to accommodate the labels myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep; // Create TextObj's to provide labels for each bar BarItem.CreateBarLabels( myPane, false, "f0" ); }
Go back to Sample Graphs
728x90
'c#' 카테고리의 다른 글
<string xmlns="http://tempuri.org/"> </string> 없애기 (0) | 2022.06.15 |
---|---|
System.Web.Helpers.Json..cctor() 메서드가 System.Web.Helpers.Json.CreateSerializer() 메서드에 액세스하지 못했습니다 (0) | 2015.09.07 |
EventType clr20r3 P9 system.io.fileloadexception (0) | 2013.04.27 |
윈도우 서비스 등록 (0) | 2013.04.27 |
메모리 사용량 체크 (0) | 2013.04.27 |
댓글