(如:Form1_Load() )中添加下列代码:
// 在坐标(40,40)处创建一个新图形, 大小为 600x400
myPane = new GraphPane( new Rectangle( 40, 40, 600, 400 ),
"My Test Graph\n(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 = + ( (double) i * );
y2 = * ( + ( (double) i * ) );
( x, y1 );
( x, y2 );
}
// 创建红色的菱形曲线
// 标记, 图中的"Porsche"
LineItem myCurve = ( "Porsche",list1, , );
// 创建蓝色的圆形曲线
// 标记, 图中的"Piper"
LineItem myCurve2 = ( "Piper",list2, , );
// 在数据变化时绘制图形
( () );
C#画统计图(ZedGraph)
最近要做一个统计分析系统,需要画统计图,听说OWC画图特别慢,而且不好看,ReportView效果不好而且生成图也很慢。于是就找了一个开源的画统计图的系统------ZedGraph.
,我现在在2005上开发,!
ZedGraph支持折线图、柱状图、饼图。
由于开发的需要,我把ZedGraph封装起来,作为一个专门的用户控件。
下面是相关的代码,可以做个参考。
//
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="" Inherits="AnalyticsGraph" %>
<%@ Register TagPrefix="zgw" Namespace="" Assembl
C#画统计图(ZedGraph) 来自淘豆网m.daumloan.com转载请标明出处.