ZedGraph的在线文档
http://zedgraph.sourceforge.net/documentation/default.html
官网的源代码 http://sourceforge.net/projects/zedgraph/?source=directory
zedgraph的demo在线范例
http://zedgraph.sourceforge.net/samples.html
这里介绍了如何实现动态加载数据,并且提供了demo
http://goorman.free.fr/ZedGraph/zedgraph.org/wiki/index3061.html?title=Display_Dynamic_or_Real-Time_Data
The ZedGraphControl can display dynamic or static data. For dynamic displays, each time you want to add data to a graph, you will need to do the following:
ZedGraph可以显示动态或者静态的数据,对于动态展示,每当你想要把数据加载到graph上的时候,你需要按照以下的步骤来做
1.Find the CurveItem of interest within the GraphPane.CurveList collection
第一步,先找到GraphPane.CurveList 中的相关曲线
2.Access the PointPairList (or other IPointListEdit type) for the CurveItem, and add the new data or modify the existing data as required
第二步,找到曲线中的PointPairList ,然后根据需要加载新数据或者修改已经存在的数据
3.Call ZedGraphControl.AxisChange() to update the auto-scaled axis ranges
第三步,调用ZedGraphControl的AxisChange()函数来更新坐标轴范围的比例
4.Call Form.Invalidate() to update the graph
第四步,调用Form.Invalidate() 来更新graph------------[貌似我没有找到这个方法,winform支持?]
The data points are stored with each CurveItem as a reference to an IPointList interface in CurveItem.Points. Note that this point list reference can be any class that implements IPointList. If it also implements IPointListEdit, thenIPointListEdit.Add() and IPointListEdit.RemoveAt() methods will be available.
The code sample is for a form that implements a ZedGraphControl with a Timer event to show dynamically updated data. You can download the complete project from the links below:
ZedGraph控件随机生成曲线的颜色,以及X轴坐标文字竖着显示==========mypane.XAxis.Scale.FontSpec.Angle = 270;//X轴的时间垂直显示
http://blog.csdn.net/happy09li/article/details/7535388
ZedGraph使用大全http://www.cnblogs.com/peterzb/archive/2009/07/19/1526726.html
//zedgraph一些属性的介绍
http://blog.chinaunix.net/uid-20776117-id-1847015.html
ZedGraph刷新数据的方法
zedGraphControl1.AxisChange();//此方法 调整坐标轴的范围
Invalidate()//使控件的特定区域无效并向控件发送绘制消息。
//调用 Invalidate 方法并不强制同步绘制;若要强制同步绘制,请在调用 Invalidate 方法之后调用 Update 方法。 在不带参数的情况下调用此方法时,会将整个工作区添加到更新区域。
zedGraphControl1.Invalidate();
zedGraphControl1.Update();
或者
zedGraphControl1.Refresh();//强制控件使其工作区无效并立即重绘自己和任何子控件。
//让坐标轴不不显示10^x;[这样做会导致比例尺失调]
zedGraphControl1.GraphPane.XAxis.Type = AxisType.Log;
zedGraphControl1.GraphPane.XAxis.Scale.IsUseTenPower = false;
IsUseTenPower ->> 是否为10次幂表示,scale为LogScale时有效。 The powers-of-ten notation is just the text "10" followed by a superscripted value indicating the magnitude. This mode is only valid for log scales. boolean value; true to show the title as a power of ten, false to show a regular numeric value (e.g., "0.01", "10", "1000")
zedGraphControl1.GraphPane.XAxis.Title.IsOmitMag
zedGraphControl1.GraphPane.XAxis.Type = AxisType.Log;
给某一个曲线加载100万点,希望横轴显示100000,200000,300000
直接设定好,坐标轴
zedGraphControl1.GraphPane.XAxis.Scale.Max = number;//设定X轴的最大值
zedGraphControl1.GraphPane.XAxis.Scale.MajorStep = number / 10;//设定最大步长
zedGraphControl1.GraphPane.XAxis.Scale.MinorStep = number / 10 / 5;//设定最小步长
zedGraphControl1.GraphPane.XAxis.Scale.FontSpec.Angle = 45;//设定X轴的字体的倾斜度
注意:一定不要调用zedGraphControl1.AxisChange();否则上面的设置就白设置了,相当于重置了
所有评论(0)