C# MSChart实时串口曲线,框选得不到PointIndex?

VS2013.NET4.0,C# Winform,Chart控件

Chart缩放设置:

 chartArea.CursorX.IsUserEnabled = true;
 chartArea.CursorX.IsUserSelectionEnabled = true;
 chartArea.AxisX.ScaleView.Zoomable = true;

 chartArea.CursorY.IsUserEnabled = true;
 chartArea.CursorY.IsUserSelectionEnabled = true;
 chartArea.AxisY.ScaleView.Zoomable = true;

Chart视野范围改变事件

 private void Chart1_SelectionRangeChanged(object sender, CursorEventArgs e)
       {
            ChartArea CA = chartDemo.ChartAreas[0];
            double X01 = CA.AxisX.ScaleView.ViewMinimum;
            double X02 = CA.AxisX.ScaleView.ViewMaximum;
            textBox1.Text = X01.ToString() + "," + X02.ToString();
        }

在静态读取数据,或产生随时间变化的动态随机曲线时,X01、X02都能取到数据点的索引值[0、1、2、3、、、]这种,但现在由串口实时读取,鼠标框选chart时,得到的X01、X02值却是如43020.8095这样4万几的超大数据。摸索了两天也没有解决这个问题,特来求教。

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C# MSchart 串口实时曲线 框选放大取值,XValue=43021.3725219384?
Visual Studio 2013 .NET4.0 C# chart控件rnrnserialPort1_DataReceived()实时接收rnrn System.Timers.Timer t = new System.Timers.Timer(10000);系统时钟定时处理rnt.Elapsed += new System.Timers.ElapsedEventHandler(theout);rnrntheout()rnrnseries.Points.AddXY(DateTime.Now, arraylist[i]);//chart曲线赋值,【X=43021.3725219384,发现现实时间每过一天X值就+1】rn chart1.ChartAreas[0].AxisX.ScaleView.Position = series.Points.Count - 5;rnrnrnChart1_SelectionRangeChanged()rnrndouble X01= chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;【X01=43021.37多】rndouble X02 =chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;【X0=43021.37多】rnrnrn当我用静态的读取表格数据来画chart曲线时X=0;X01与X02显示为PointIndex数据索引(0,1,2,3...)rn当我用动态的随机Y,实时X来画chart曲线时X=0.4137几;X01与X02显示为PointIndex数据索引(0,1,2,3...)rnrn为什么当用串口实时数据来画chart曲线时X=43021.37几;X01与X02显示为43021.37几rn为什么XValue从0变到了四万多,同时导致我框选不到索引值?rnrn我只是想取两个X索引值,花了近3天了,实在解不出,在此求教大家了
MSChart实时曲线
微软推出的免费控件,在工业监控软件开发中能大大降低开发成本,该控件用来做各种参数实时监控、数据图形显示很是方便,本例采用Chart控件实现实时曲线显示,示例很简单,权当抛砖引玉吧。
MsChart 实时曲线
用 ScriptManager ,timer, 来做一个实时动态曲线图,每3秒从数据库中提取最新一条数据给Y轴赋值,设定X轴数值大于20的时候,X轴数值自动加1,rn[code=C#]rnrn while (this.Chart1.Series[0].Points.Count > 20)rn rn foreach (Series s in this.Chart1.Series)rn rn s.Points.RemoveAt(0);rn rn rnrn double axisMinimum = this.Chart1.Series[0].Points[0].XValue;rn this.Chart1.ChartAreas[0].AxisX.Minimum = axisMinimum;rn this.Chart1.ChartAreas[0].AxisX.Maximum = axisMinimum + 20;rn[/code]rn曲线走到21,就报错:索引超出范围rnrnrn代码片段rnrn[code=C#]rnrnprotected void Page_Load(object sender, EventArgs e)rn rn rn if (!IsPostBack)rn rn string strWhere = "";rn DataTable myDataTable0 = tools.GetPageInfoTable("wxdysjjc", "bh,cgqmc,sbbh", "id", "0", strWhere, 0);rn if (myDataTable0.Rows.Count > 0)rn rn this.Chart1.Series[0].Points.AddXY(0, 0);rn foreach (DataRow row in myDataTable0.Rows)rn rn string seriesName = row["cgqmc"].ToString();rn Chart1.Series.Add(seriesName);rn Chart1.Series[seriesName].ChartType = SeriesChartType.Line;rn Chart1.Series[seriesName].BorderWidth = 1;rn this.Chart1.Series[seriesName].Points.AddXY(0, 0);rnrn sbbhlist += row["sbbh"].ToString() + ",";rn rn this.shebei_bh.Value = sbbhlist;rn rnrn rn // Chart1.Titles.Add("数据监测");rn Chart1.ChartAreas[0].AxisY.Title = "数值";rnrn this.Chart1.Series[0].IsVisibleInLegend = true;rn this.Chart1.ChartAreas[0].AxisX.Interval = 2;//数据间隔rn this.Chart1.ChartAreas[0].AxisX.MinorTickMark.Interval = 2;//刻度rn this.Chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = true;//显示刻度rnrn rn protected void timer1_Tick(object sender, EventArgs e)rn rn string allbh = this.shebei_bh.Value;rn string strTmp = allbh.Substring(0, allbh.Length - 1);rn if (strTmp != "")rn rn string[] sbbhlist = strTmp.Split(',');rnrn for (int i = 0; i < sbbhlist.Length; i++)rn rn Series series = this.Chart1.Series[i];rnrn int xCount = series.Points.Count == 0 ? 0 : series.Points.Count - 1;rn // double lastXValue = series.Points.Count == 0 ? 1 : series.Points[xCount].XValue + 1;rnrn double lastYValue = series.Points[series.Points.Count - 1].YValues[0];rn double lastXValue = series.Points[series.Points.Count - 1].XValue + 1;rn string strwhere = tools.GetWherePrameter("sbbh", "sbbh", sbbhlist[i].ToString(), DbOperator.Equal);rn DataTable DataTablejilu = tools.GetPageInfoTable("wxdylsjl", "*", "cj_sj", "1", strwhere, 1);rn if (DataTablejilu.Rows[0]["zhi"].ToString() != "")rn rn lastYValue = Convert.ToInt32(DataTablejilu.Rows[0]["zhi"].ToString());rn rn elsern rn lastYValue = 0;rn rn lastYValue = Convert.ToInt32(DataTablejilu.Rows[0]["zhi"].ToString());rn series.Points.AddXY(lastXValue++, lastYValue);rnrn while (this.Chart1.Series[0].Points.Count > 20)rn rn foreach (Series s in this.Chart1.Series)rn rn s.Points.RemoveAt(0);rn rn rnrn double axisMinimum = this.Chart1.Series[0].Points[0].XValue;rn this.Chart1.ChartAreas[0].AxisX.Minimum = axisMinimum;rn this.Chart1.ChartAreas[0].AxisX.Maximum = axisMinimum + 20;rnrn rn rnrn rnrnrn rnrn[/code]rnrnrn前台rnrn[code=HTML]rn rn rn rn rn rn rn rn rn<%-- rn rn rn --%>rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]
怎样用mschart实现实时曲线
在数据采集中,怎样用mschart实现实时曲线?
mschart显示实时曲线.ra
这个用的人应较多 源码啊 以下为类的字段 private int width; 要生成曲线图的宽度 private int height; 要生成曲线图的高度 private int N 31; 取31个关键点 private int M 25; 每M个像素点取一个关键点 private Point[] pointList; 用来绘制曲线的关键点 依次将这些点连接起来即得到曲线 private Random random new Random ; 生成随机数 private Bitmap currentImage; 当前要绘制的图片 private Color backColor; 图片背景色 private Color foreColor; 图片前景色 &lt;summary&gt;">这个用的人应较多 源码啊 以下为类的字段 private int width; 要生成曲线图的宽度 private int height; 要生成曲线图的高度 private int N 31; 取31个关键点 private int M 25; 每M个像素点取一个关键点 [更多]
串口读数实时动态曲线
基于FRDM-K64F板子可以从串口得到重力加速度实时数据,我用VB编写了上位机软件将实时数据用动态曲线展现出来。有需要串口开发和实时曲线绘制的朋友也有一定的参考价值。
Qt串口接收数据实时曲线
Qt界面,主要功能有1:串口收发数据 2:Qt实时显示串口接收数据
串口数据采集和画实时曲线
里边包括发送和接受函数的源代码,使用的是vc自带的mscomm控件,用teechart控件显示实时曲线
VC Teechart5串口实时曲线
线程串口实时绘制曲线,采用VC Teechart5控件实现。支持串口设置,曲线放大支持曲线放大、缩小 坐标移动。
串口采集数据实时曲线
通过串口采集数据并实时显示趋势曲线,很有用的也费了很大力气写的
基于vC6.0的串口实时数据采集及实时曲线
VC做上位机,实时数据采集以及实时绘制曲线
MSChart绘制可缩放的动态实时曲线
基于mschart控件,绘制工控采集类曲线,可对图像进行缩放,拖动滚动条显示放大后的图像
C#中MSchart绘制曲线
通过利用C#中的chart控件绘制数据曲线
C#绘制实时曲线
1.要做一个调试工具,采集传感器数据并显示。绘制曲线注意坐标反转,线条的张力即可。项目中的曲线是从右往左显示的,线条的坐标都放在list里了,效果如下图: 2.上代码 public class DrawingCurve { private Graphics graphics; //Graphics 类提供将对象绘制到显示设备的方法
基于c#的实时曲线
这个是一个用vs自带的chart控件做的一个动态实时曲线图,能同时将采集到的数据绘制成多条实时动态的曲线,
C#中的实时曲线
高手们,在C#WINFORM中各位是如何做实时曲线的,有没有方便实用的控件?
C#实时曲线显示
利用C#中的chart控件,采用委托机制。实时显示曲线,并且加以时间标注。 本程序开发环境VS2010,测试数据采用随机数动态生成; 本程序可以广泛的用于电力行业的的实时功率显示,电压、电流等数据实时显示等用途。
mschart 数组曲线(多条曲线)
Private Sub Command1_Click()rnOn Error Resume NextrnDim data() As Stringrndata() = Split(Text1.Text, ",")rnFor j = 0 To UBound(data())rn If data(j) = "" Thenrn MsgBox "请输入您要分析的ID号"rn Exit Subrn End Ifrn txtSQL = "select * from 监控温度表 where id = " & data(j) '查询语句rn Set rs = ESQL(txtSQL) '执行查询语句rn If rs.RecordCount > 0 Then '当记录大于零时rn rs.MoveFirst '移到第一条记录rn nums = rs.RecordCount '给nums赋值rn ReDim arrValues(1 To nums, 1 To 3) '定义动态数组rn For i = 1 To nums '给数组赋值rn arrValues(i, 1) = " " '& Format(rs1!时间, "hh:mm")rn arrValues(i, 2) = val(rs.Fields("温度"))rn arrValues(i, 3) = val(Rnd * 20 + 15) '我添加了条随机显示数据的曲线rn rs.MoveNextrn Next irn MSChart1.ChartData = arrValuesrn End IfrnNext jrnEnd Subrn比如现在我 在 text1.text 中输入id号为1,2,3,4rn则在 mschart中显示出id=(1,2,3,4)4条曲线rn横坐标为时间轴 纵坐标为 温度rn现在我输入的总是得到的是最后 一个ID号的曲线
C# 串口实时心电图
[img=http://img.my.csdn.net/uploads/201304/11/1365670837_7705.jpg][/img]我们的要求是1秒钟512个点,把这一秒钟的数据平均显示在1秒的5个大格子里,这个应该怎么控制X轴的移动呢?rn我现在是每2毫秒刷新一次(画一个点)这样1秒只能画500个点,2秒刷新一次界面闪屏很厉害,请各位大侠指点1、2.我的基本代码是这样的rn private void Form1_Load(object sender, EventArgs e)rn rn ptlist = new Point[this.pictureBox1.Width];rn Point pt;rn for (int i = 0; i < this.pictureBox1.Width; i++)rn rn pt = new Point();rn pt.X = i;rn pt.Y = 255;rn ptlist[i] = pt;rn rn timer1.Enabled = true;rn timer1.Interval = 2;rn rnprivate void timer1_Tick(object sender, EventArgs e)rn rn //pictureBox1画图区域rn //ptlist rn //alECGFisrt接收到的心电数据rn DrawLineS(Color.Blue, pictureBox1, ptlist, alECGFisrt);rnrn rnpublic void DrawLineS(Color color,PictureBox picbox, Point[] ptlist, ArrayList alECGFisrt)rn rn mybitmap = new Bitmap(picbox.Width, picbox.Height);//设定位图大小rn Graphics doublebufferg = Graphics.FromImage(mybitmap);//从位图上获取画布rn doublebufferg.Clear(Color.White);//用背景色刷新rn //pictureBox1填充为白色,便于显示图像 rn Rectangle rect = new Rectangle(0, 0, picbox.Width, picbox.Height);rn doublebufferg.FillRectangle(new SolidBrush(Color.White), rect);rnrn //画网格线rn SetXAxis(ref doublebufferg, picbox);rn SetYAxis(ref doublebufferg, picbox);rn ////绘制实时随机曲线rn Point temp = new Point();rn int ptX = 0;rn for (int j = 1; j < picbox.Width-1; j++)rn rn temp = ptlist[j + 1];rn ptX = temp.X - 1;rn ptlist[j] = new Point(ptX, temp.Y);rn rn Point lastpt = new Point();rn lastpt.X = picbox.Width;rn if (alECGFisrt.Count > 0)rn rn lastpt.Y = Convert.ToInt32(alECGFisrt[0].ToString());rn alECGFisrt.RemoveAt(0);//画一个点移除出alECGFisrtrn rn elsern lastpt.Y = 255;//255是基线rn ptlist[picbox.Width - 1] = lastpt;//替换最后一个点rn doublebufferg.DrawLines(new Pen(Color.Red, 2), ptlist);rnrn //将缓冲中的位图绘制到窗体上rn Graphics g1 = picbox.CreateGraphics();//创建 PictureBox窗体的画布rn g1.Clear(Color.White);rn g1.DrawImage(mybitmap, 0, 0);rn
C#串口实时监听
因为是搞电控的,但是项目要用C#,在winCE下运行,在网上下了段API 读写串口的程序,打开串口和写串口都没问题;希望串口有数据时可以实时监听到,但是不知道怎么写实时监听串口的部分,请大家帮帮忙,rn 一,串口操作类主要内容rn public bool OpenPort(string lpFileName,int baudRate,byte parity, byte byteSize, byte stopBits) rn rn // OPEN THE COMM PORT. rn hComm = CreateFile(lpFileName ,GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); rn // IF THE PORT CANNOT BE OPENED, BAIL OUT. rn if(hComm == INVALID_HANDLE_VALUE) rn rn return false; rn rnrn SetupComm(hComm, MAXBLOCK, MAXBLOCK); rnrn // SET THE COMM TIMEOUTS. rn COMMTIMEOUTS ctoCommPort = new COMMTIMEOUTS(); rn GetCommTimeouts(hComm,ref ctoCommPort); rn ctoCommPort.ReadIntervalTimeout = Int32.MaxValue; rn ctoCommPort.ReadTotalTimeoutConstant = 1000; rn ctoCommPort.ReadTotalTimeoutMultiplier = 0; rn ctoCommPort.WriteTotalTimeoutMultiplier = -1; rn ctoCommPort.WriteTotalTimeoutConstant = 1000; rn SetCommTimeouts(hComm,ref ctoCommPort); rnrnrn DCB dcbCommPort = new DCB(); rn dcbCommPort.DCBlength = Marshal.SizeOf(dcbCommPort); rn GetCommState(hComm, ref dcbCommPort); rn dcbCommPort.BaudRate = baudRate; rn dcbCommPort.Parity = parity; rn rn dcbCommPort.fBinary = 0;rn dcbCommPort.fParity = 0;rn dcbCommPort.ByteSize = byteSize; rn dcbCommPort.StopBits = stopBits;rn dcbCommPort.fOutxCtsFlow = 0;rn dcbCommPort.fOutxDsrFlow = 0;rn dcbCommPort.fRtsControl = 1;rn dcbCommPort.fDtrControl = 1;rnrnrn SetCommState(hComm, ref dcbCommPort); rn PurgeComm(hComm, PURGE_RXCLEAR | PURGE_RXABORT); rn PurgeComm(hComm, PURGE_TXCLEAR | PURGE_TXABORT); rnrn bOpened = true; rn return true; rn rnrn // 关闭串口 rn public bool ClosePort() rn rn if (hComm == INVALID_HANDLE_VALUE) rn rn return false; rn rnrn if (CloseHandle(hComm)) rn rn hComm = INVALID_HANDLE_VALUE; rn bOpened = false; rn return true; rn rn else rn rn return false; rn rn rnrn // 往串口写数据 rn public bool WritePort(byte[] WriteBytes,int dwLen)rn rn if (hComm == INVALID_HANDLE_VALUE) rn rn return false; rn rnrn COMSTAT ComStat = new COMSTAT(); rn int dwErrorFlags = 0; rnrn ClearCommError(hComm, ref dwErrorFlags, ref ComStat); rn if (dwErrorFlags != 0) rn PurgeComm(hComm, PURGE_TXCLEAR | PURGE_TXABORT); rnrn OVERLAPPED ovlCommPort = new OVERLAPPED(); rn int BytesWritten = 0;rnrn return WriteFile(hComm, WriteBytes, dwLen, ref BytesWritten, ref ovlCommPort);rn rn rn rn // 从串口读数据 rn public int ReadPort(int NumBytes, byte[] commRead) rn rn if (hComm == INVALID_HANDLE_VALUE) rn rn return 0; rn rnrn COMSTAT ComStat = new COMSTAT(); rn int dwErrorFlags = 0; rnrn ClearCommError(hComm, ref dwErrorFlags, ref ComStat); rn if (dwErrorFlags != 0) rn rn PurgeComm(hComm, PURGE_RXCLEAR | PURGE_RXABORT); rn rnrn if (ComStat.cbInQue > 0) rn rn OVERLAPPED ovlCommPort = new OVERLAPPED(); rn int BytesRead = 0; rn ReadFile(hComm, commRead, NumBytes, ref BytesRead, ref ovlCommPort); rn return BytesRead;rn rn else rn rn return 0; rn rn rnrn rnrnrn二,主界面程序 主要程序rnnamespace CommPortrnrn public class Form1 : System.Windows.Forms.Formrn rn private Class1 cl1 = new Class1();rn rn public Form1()rn rn InitializeComponent();rn rnrnrn /// rn /// 应用程序的主入口点。rn /// rnrn static void Main() rn rn Application.Run(new Form1());rn rnrn private void button1_Click(object sender, System.EventArgs e)rn rn tryrn rn cl1.OpenPort("COM2:",115200,0,8,1);rn MessageBox.Show("open");rn rn catchrn rn MessageBox.Show("error");rn rn rnrn private void button2_Click(object sender, System.EventArgs e)rn rn byte [] byread = new byte [100];rn port.Read(ref byread,100);rn rnrn private void button3_Click(object sender, System.EventArgs e)rn rn string ss = "中国电子器件\n";rn wdata = System.Text.Encoding.Default.GetBytes(ss);rn cl1.WritePort(wdata, wdata.Length);rn rn rnrnrn麻烦大家帮忙rn
c#在panel里画实时曲线,曲线不能实时运动
我想在panel里画实时曲线,但是用以下语句不能实现它的实时运动rnprivate void panel1_Paint(object sender, PaintEventArgs e)rn rn Image image = rti.GetCurrentCurve();rn Graphics g = panel1.CreateGraphics();rn //用指定背景色清除当前窗体上的图象 rn g.Clear(backColor);rn g.DrawImage(image, 0, 0);rn g.Dispose();rn //每秒钟刷新一次 rn Thread.Sleep(1000);rn rn怎样才能实现他的实时运动呢?
c# .net实时曲线显示
老外写的一个实时显示的曲线控件,代码齐全,可供参考,学习用
基于windows ce的串口实时绘制曲线
基于windows ce的串口实时通讯技术,并将接受数据绘制成曲线,亲测好使。
串口温度数据采集系统并实时显示曲线
这是一个串口温度采集系统,能够正确的读出串口传来的数据,并且可以根据数据来动态绘制曲线
读取串口数据并绘制实时曲线
读取串口数据 用vc++实现实时曲线的绘制的所有程序源码
基于VC实现串口数据实时曲线
基于VC实现串口数据实时曲线绘制以及数据库操作
串口接收+实时曲线(VB6 源码)
串口接收的地方,我是用的自己的开发板,如有需要可以自行删减 实时曲线绘制是用的几个picbox,实现曲线在窗口动态左移的效果,类似任务管理器中的实时曲线效果
VB 作串口实时数据采集曲线
我这有一段VB程序是为了画实时采集曲线的。rnrn软件编程我不行,如果大家有看得懂得,请帮我看看。rnrn程序不多rnrnPrivate Sub MSComm1_OnComm()rn Dim Inbyte() As Bytern Dim buffer As Stringrn Dim datatemp(1000) As Single rn If num > 199 Then Call renew '刷新绘图区rn '读取仪表返回数据串rn Select Case MSComm1.CommEventrn Case comEvReceivern Inbyte = MSComm1.Input'这地方看不懂,数组可以这样赋值吗?rn rn For i = LBound(Inbyte) To UBound(Inbyte)rn buffer = buffer + Hex(Inbyte(i)) + Chr(32) 'for语句也没看懂,尤其是buffer这赋的是什么值?rn Next irn Case comEvSendrn End Selectrn '获取十进制测量数据rn ’这下面的又是没看懂,应该是将十六进制转换为十进制,怎么转换的呢?rn If Len(Trim(Mid(buffer, 1, 2))) = 1 Thenrn datatemp(num) = Val("&H" & Mid(buffer, 3, 2) & Str("0") & Mid(buffer, 1, 2)) * 0.01rn Elsern datatemp(num) = Val("&H" & Mid(buffer, 3, 2) & Mid(buffer, 1, 2)) * 0.01rn End Ifrnrnrn‘绘制曲线rnPrivate Sub draw()rn Picture1.Clsrn Picture1.DrawWidth = 2rn Picture1.BackColor = QBColor(7)rn’下面的程序我看不懂,用的是什么原理画的曲线呢?rn Picture1.Scale (0, 50)-(200, 0)rn For i = 1 To num - 1rn X1 = (i - 1): Y1 = datatemp(i - 1)rn X2 = i: Y2 = datatemp(i)rn Picture1.Line (X1, Y1)-(X2, Y2), QBColor(1)rn Next irnEnd Subrn
vc++下 读取串口数据 实时曲线
小弟是个刚入IT业的菜鸟,经理让我做个读取串口数据的东西,然后画出波形,三组数据输出。没有限制时间,所以我想请教,如何入手,有什么这方面的书籍或者视频可以推荐的。或者是应该从哪方面入手。万分感谢
vc++上位机串口程序(实时曲线功能)
基于vc++的串口通信上位机程序,具有实时曲线功能
跪求VB 作串口实时数据采集曲线
各位大侠:rn 小弟现在需在VB串口上位机加入将串口采集回来的数据以历史曲线显示的功能,能发个例子程序给我么,或告诉我怎么做!以下是小弟在论坛上看到的,有些不懂,不知道哪个死picture控件。各位大侠求助啊rn实时曲线左移函数,定义在模块中rn[code=vb] Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Longrn rn'建立一个类,作为画实时曲线rn Option Explicitrn rnPublic pCurveNUM As Integerrn Public pCurveName As Stringrn Public pCurveMax As Doublern Public pCurvemin As Doublern rnPrivate pricCurve As PictureBoxrn Private priCurvePoint(6) As Integerrn Private priCurveData(6) As Doublern Private priDrawY0(6) As Doublern Private priDrawY1(6) As Doublern Private priDrawNMinute As Integerrn Private priDrawTMinute As Integerrn rnPrivate WithEvents priTimerDraw As Timerrn rnPublic Property Let ltDrawTimer(ByRef lTimer As Timer)rn rn Set priTimerDraw = lTimerrn rn End Propertyrn rnPublic Property Let ltGiveCurveData(ByVal lDataPoint As Variant)rn Dim i%rn For i = 1 To pCurveNUMrn priCurvePoint(i) = CInt(lDataPoint(i))rn Nextrn End Propertyrn rnPublic Property Let ltGetPicture(ByRef lDrawPicBox As PictureBox)rn Set pricCurve = lDrawPicBoxrn End Propertyrn rnrnrnPrivate Sub sDrawTheRealTimeCurve()rn rn Dim ypixels, xpixels, i%rn Dim ShowMode As Long, ii As Long, tm As String, hBmp As Longrn pricCurve.DrawWidth = 1rn hBmp = pricCurve.hDCrn ShowMode = &HCC0020rn ii = BitBlt(hBmp, 0, 0, pricCurve.ScaleWidth - 1, pricCurve.ScaleHeight - 1, hBmp, 1, 0, ShowMode)rn Dim T As Integerrn T = Minute(Now())rn priDrawNMinute = Trn If priDrawNMinute > priDrawTMinute Thenrn pricCurve.CurrentX = pricCurve.ScaleWidth - 19rn pricCurve.CurrentY = pricCurve.ScaleHeight - 11rn pricCurve.Print priDrawNMinutern End Ifrn priDrawTMinute = priDrawNMinutern pricCurve.ScaleMode = vbPixelsrn ypixels = pricCurve.ScaleHeight - 1rn xpixels = pricCurve.ScaleWidth - 1rn rn 'For 1 to 6 curvesrn If pCurveNUM > 6 Or pCurveNUM < 1 Then pCurveNUM = 1rn For i = 1 To pCurveNUMrn priDrawY1(i) = CInt(ypixels - (priCurveData(i) - pCurvemin) / (pCurveMax - pCurvemin) * ypixels)rn If priDrawY1(i) = priDrawY0(i) Then priDrawY1(i) = priDrawY1(i) + 1rn Nextrn pricCurve.Line (xpixels - 1, priDrawY0(1))-(xpixels - 1, priDrawY1(1)), vbRedrn If pCurveNUM > 1 Then pricCurve.Line (xpixels - 1, priDrawY0(2))-(xpixels - 1, priDrawY1(2)), vbWhitern If pCurveNUM > 2 Then pricCurve.Line (xpixels - 1, priDrawY0(3))-(xpixels - 1, priDrawY1(3)), vbGreenrn ' If pCurveNUM > 3 Then pricCurve.Line (xpixels - 1, priDrawY0(4))-(xpixels - 1, priDrawY1(4)), spColor(3).FillColorrn ' If pCurveNUM > 4 Then pricCurve.Line (xpixels - 1, priDrawY0(5))-(xpixels - 1, priDrawY1(5)), spColor(4).FillColorrn ' If pCurveNUM > 5 Then pricCurve.Line (xpixels - 1, priDrawY0(6))-(xpixels - 1, priDrawY1(6)), spColor(5).FillColorrn For i = 1 To 6rn priDrawY0(i) = priDrawY1(i)rn Nextrn rn End Subrn rnPublic Sub clsInit()rn rn Dim i%rn rn For i = 1 To 6rn priDrawY0(i) = pricCurve.Heightrn priDrawY1(i) = pricCurve.Heightrn Nextrn rn priTimerDraw.Interval = 1000rn priTimerDraw.Enabled = Truern End Subrn rnPrivate Sub priTimerDraw_Timer()rn rn Dim i%rn For i = 1 To pCurveNUMrn priCurveData(i) = gRealTimeData(priCurvePoint(i))rn Nextrn Call sDrawTheRealTimeCurvern rn End Sub[/code]rn
串口数据的曲线实时显示代码
串口接收数据然奇偶曲线实时显示。用mschart控件的功能进行显示
基于MATLAB实时串口数据采集与曲线显示
基于 MATLAB 实时串口 数据采集 与曲线显示
Static控件串口数据实时曲线
哪位大虾有派生于CStatic的画串口曲线的类,可以实现输入串口数据就画出曲线,曲线可以设置颜色,一个控件可以画多条曲线,最好是常规的从横坐标零点开始画,在一个界面多的点画,不用左右移动界面。谢谢···
vc++ 串口接收数据画实时曲线
我已经建了一个基于对话框的串口通信的工程,希望能够 当按下一个按钮,能够弹出一个窗口,可以显示实时曲线。。。。应该要怎样????rn我找到了一个clPlot 的,是一个多文档的工程,可以显示实时曲线的。。。。。问题是我应该怎样将其加入到我的基于对话框的串口通信的工程中呢????
C# MSCHART 曲线指示数据点
private void chart1_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == System.Windows.Forms.DataVisualization.Charting.ChartElementType.DataPoint) {
请教:c#用mschart画曲线的问题。
c#用mschart画曲线遇到以下问题:y轴的第4个点是空值,想要的结果是此点是断开的,结果系统当成0给连了,请教各位高手,此问题该如何解决?代码如下:rn chart1.Series["Series1"].ChartType = SeriesChartType.Line;rn string[] Y="10","10","10","","10","10","10","10","10","10";rn int[] X = 1, 2, 3, 4, 5, 6, 7, 8,9,10 ; rn for (int i = 0; i < 10; i++)rn rn chart1.Series["Series1"].Points.AddXY(X[i],Y[i]); rn
实时曲线
 现在有一个需求是从串口采取数据深度数据,然后绘制实时曲线,现在就是不知道怎么样把采出的工程值换算成坐标值,Y轴是深度,X轴是数值,比如我采集出一个值是1000米,那对应的屏幕Y坐标应该怎么换算,屏幕要滚动,江湖救急啊![img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/69.gif][/img]
MsChart动态曲线 VC6
根据http://www.cnblogs.com/wy-wangyan/archive/2011/05/13/2045851.html 利用MsChart控件做的动态曲线实例,供大家参考
MsChart曲线更新
1、我每隔一定的时间更新一次MsChart1.ChartData ,但是每次更新时,画面就会跳动一下,有什么方法让整个控件不变,只是里面的曲线变化。rn2、怎么变化曲线的粗细宽度?
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法