4.在你的窗体 Load 方法(如:Form1_Load() )中添加下列代码:
// 在坐标(40,40)处创建一个新图形, 大小为 600x400
myPane = new GraphPane( new Rectangle( 40, 40, 600, 400 ),
"My Test Graph(For CodeProject Sample)",
"My X Axis",
"My Y Axis" );
// 设置初始数据
double x, y1, y2;
PointPairList list1 = new PointPairList();
PointPairList list2 = new PointPairList();
for ( int i=0; i<36; i++ )
{
x = (double) i + 5;
y1 = 1.5 + Math.Sin( (double) i * 0.2 );
y2 = 3.0 * ( 1.5 + Math.Sin( (double) i * 0.2 ) );
list1.Add( x, y1 );
list2.Add( x, y2 );
}
// 创建红色的菱形曲线
// 标记, 图中的 "Porsche"
LineItem myCurve = myPane.AddCurve( "Porsche",list1, Color.Red,
SymbolType.Diamond );
// 创建蓝色的圆形曲线
// 标记, 图中的 "Piper"
LineItem myCurve2 = myPane.AddCurv( "Piper",list2, Color.Blue,
SymbolType.Circle );
// 在数据变化时绘制图形
myPane.AxisChange( this.CreateGraphics() );
C#画统计图(ZedGraph)
最近要做一个统计分 析系统,需要 画统计图,听 说 OWC 画图特 别慢,而且不 好看 ,
ReportView 效果不好而且生成图也很慢。于是就找了一个开源的画统计图的系统------
ZedGraph.
选 ZedGraph 的另一个主要目的是它的开源代码有.NET2.0 的版本,我现在在 2005 上开发,
有 2.0 的程序当然最好了!
评论3