ZedGraph如何动态的加载曲线

摘要:
title=显示动态或实时数据ZedGraphControl可以显示动态或静态数据。对于动态显示,每次要向图形中添加数据时,都需要执行以下操作:ZedGraph可以显示动态或静态数据。对于动态显示,每当您想要将数据加载到图形中时,都需要遵循以下步骤。1.在GraphPane中查找感兴趣的CurveItem。CurveListcollection,首先在GraphPane中查找相关曲线。CurveList 2.访问CurveItem的PointPairList,并根据需要添加新数据或修改现有数据步骤2:在曲线中找到PointPair列表,然后根据需要加载新数据或更改现有数据3.调用ZedGraphControl AxisChange()更新自动缩放范围步骤3,调用ZedGraph Control的AxisChange(()函数更新坐标轴范围4的比例。呼叫表单。Invalide()更新图表第4步,调用Form Invalidate()更新图形--------------[我似乎没有找到此方法。Winform支持?ZedGraphControl1.Invalidate);ZedGrafControl1.update();或ZedGrahControl1.Refresh();//强制控件使其工作区无效,并立即重新绘制其自身和任何子控件。

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

true to show the magnitude value, false to hide it .   //IsOmitMag为true的时候,显示数量级,为false的时候,不显示
For large scale values, a "magnitude" value (power of 10) is automatically used for scaling the graph. This magnitude value is automatically appended to the end of the Axis Title (e.g., "(10^4)") to indicate that a magnitude is in use. This property controls whether or not the magnitude is included in the title. Note that it only affects the axis title; a magnitude value may still be used even if it is not shown in the title. 
对于大数量级,10幂,会自动显示;数量级会自动加载坐标的Title后面,无论IsOmitMag是true还是false;它仅仅是影响Title,数量级还是正常的影响坐标系的。
 
 
以加载100万数据为例子,说明上面几个的属性
默认状态下的加载界面
 zedGraphControl1.GraphPane.XAxis.Title.IsOmitMag 此属性默认为false,X轴的标题显示10的幂
ZedGraph如何动态的加载曲线第1张
将zedGraphControl1.GraphPane.XAxis.Title.IsOmitMag 设置为true的时候,就不显示10的幂了
ZedGraph如何动态的加载曲线第2张
 
 
 
zedGraphControl1.GraphPane.XAxis.Type = AxisType.Log;//横轴按照10的幂为步长//默认横轴是按照10的幂来显示的
ZedGraph如何动态的加载曲线第3张
 

zedGraphControl1.GraphPane.XAxis.Type = AxisType.Log;
zedGraphControl1.GraphPane.XAxis.Scale.IsUseTenPower = false;//横轴不显示成10的幂
ZedGraph如何动态的加载曲线第4张

给某一个曲线加载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();否则上面的设置就白设置了,相当于重置了

ZedGraph如何动态的加载曲线第5张

免责声明:文章转载自《ZedGraph如何动态的加载曲线》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇android之DPAD上下左右四个键控制类3(友元)下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

EdgeX 1.2研究-2 读取Modbus协议设备

1、使用的基于下面这个链接的示例: https://docs.edgexfoundry.org/1.2/examples/Ch-ExamplesAddingModbusDevice/ 这个示例没有跑通,主要卡在这里的讲解配置文件和下载的版本对应不上,经过两天的摸索,使用如下方式实现 2、使用下面compose文件安装 # /***************...

Hyperledger Fabric 安装

  前一篇已经准备好了运行环境,本篇将介绍Fabric的安装以及测试网络环境   Fabric的安装   HyperFabric安装大致可以分成两种,     第一:使用自带在脚本安装,可以下载fabric-sample和二进制文件到操作系统,简化安装过程。     第二:以源码在方式进行本地编译安装,此方式相对第一种比较复杂,需手动编译生存相应工具。  ...

c# C#设置WebBrowser使用Edge内核

开始尝试是用 Microsoft.Toolkit.Forms.UI.Controls.WebView,后来发现一大堆问题,还要求WIN10 SDK的版本之类的。 网上看到的简单的解决办法(只需要修改注册表)(前提是win10系统需要安装Edge浏览器): 这个函数是网上复制的, 传入11000是IE11, 9000是IE9, 只不过当试着传入6000时,...

去除win10中Edge的新建标签页广告

听人安利多了microsoft的Edge浏览器各种好处,想着也许就可以替代chrome了也不错,至少可以少安装一个浏览器,装上之后,的确比较香,但是每次新建标签页就是: 在菜单中设置--隐私、搜索和服务--防止跟踪--跟踪防护--严格 最后的效果: 后来发现在页面设置中--页面布局--自定义{ 显示快速链接:关闭 背景:关闭 内容:内容关闭 } 就会有...

Xceed WinForm数据表格控件Xceed Grid For .NET控件详细介绍及下载地址

Xceed Grid For .NET是一款高级的,多功能的、扩展性极强的数据表格控件,具有分组、主从表、多种主题外观、固定列和行、Excel导出、支持Vista风格,交互的外观样式,内嵌报表功能,支持导出为PDF、HTML、TIFF、JPEG,以及打印报表等多种功能,是现在业界最强大的表格控件。 特殊功能: 控件使用Cell UI虚拟化,大大提高...

为什么edge AI是一个无需大脑的人

为什么edge AI是一个无需大脑的人 Why edge AI is a no-brainer 德勤预计,到2020年,将售出超过7.5亿个edge AI芯片,即在设备上而不是在远程数据中心执行或加速机器学习任务的全芯片或芯片的一部分,收入将达到26亿美元。此外,边缘人工智能芯片市场的增长速度将远远超过整个芯片市场。到2024年,预计edge人工智能芯片...