zoukankan      html  css  js  c++  java
  • winform 绘图控件 chart 实时曲线图

     

    实现思路:线程 while (true)循环,当集合满了10个元素之后,每次再进行绘制 需要移除第一个点,添加新点到集合末尾。
    这个chart控件十分的强大 网上资料也很多。我也只了解皮毛,刚好够解决我的问题。所以没啥写的。
    chart初始化:
     th = new Thread(GetData);
                chart1.Series[0].Name = strLinePh;
                chart1.Series[0].Color = Color.Red;
                chart1.Series.Add(strLinePress);
                chart1.Series[1].Color = Color.Blue;
               
                chart1.ChartAreas[0].AxisY2.ArrowStyle = AxisArrowStyle.Triangle;
                //chart1.ChartAreas[0].Axes[3].Interval = 50;
                chart1.Series[strLinePress].YAxisType = AxisType.Secondary;
                chart1.Titles.Add("PH 压力 实时曲线");
                chart1.Legends[0].LegendStyle = LegendStyle.Row;
                chart1.Legends[0].Docking = Docking.Top;
                chart1.ChartAreas[0].AxisX2.LineColor = Color.Transparent;
    
                var cArea = chart1.ChartAreas[0];
                cArea.AxisY.LineColor = Color.Red;
                cArea.AxisY2.LineColor = Color.Blue;
                cArea.AxisY.Minimum = 0;
                cArea.AxisY.Maximum = 7;
                cArea.AxisY2.Minimum = -50;
                cArea.AxisY2.Maximum = 50;
    
                cArea.AxisX2.LineColor = Color.DarkGreen;
                cArea.AxisY2.MajorGrid.LineColor = Color.Transparent;
                cArea.AxisX.MajorGrid.LineColor = Color.Transparent;
                cArea.AxisX.ArrowStyle = AxisArrowStyle.Triangle;
                cArea.AxisY.ArrowStyle = AxisArrowStyle.Triangle;
    
    
                // Set series chart type
                chart1.Series[strLinePh].ChartType = SeriesChartType.Line;
                chart1.Series[strLinePress].ChartType = SeriesChartType.Line;
    
                // Set point labels
                chart1.Series[strLinePh].IsValueShownAsLabel = true;
                chart1.Series[strLinePress].IsValueShownAsLabel = true;
    
                // Enable X axis margin
                chart1.ChartAreas[0].AxisX.IsMarginVisible = true;
    
                chart1.Visible = false;
  • 相关阅读:
    Kubernetes的RBAC是啥
    《高效学习的七个习惯》总结
    Kubernetes的CronJob对象
    Kubernetes的Job对象
    什么是DaemonSet
    Docker容器日志路径
    什么是StatefulSet
    Kubernetes的Deployment对象使用
    MXNET:卷积神经网络基础
    MXNET:深度学习计算-GPU
  • 原文地址:https://www.cnblogs.com/HelloQLQ/p/15359049.html
Copyright © 2011-2022 走看看