Chart control X axis growing and growing and it looks like it not moving

后端 未结 1 1026
礼貌的吻别
礼貌的吻别 2021-01-16 07:57

I have application with real time Chart control that received date and display this on my control:

This is my control:

MyObject obj...

Series series         


        
相关标签:
1条回答
  • 2021-01-16 08:35

    You keep adding points to the chart, but don't ever remove them. So, when you call chart.ResetAutoValues(), it sets the minimum on the x-axis below the x value of your first point, and the maximum above (or equal to) the x value of your last point. The maximum keeps getting bigger, but the minimum never changes, so the graph looks compressed as time goes on. You can start to remove points once you reach some threshold, like this:

    private void chartTimer_Tick(object sender, EventArgs e)
    {
        if (series.Points.Count() > 1000) series.Points.RemoveAt(0);
        series.Points.Add(wf.BitsPerSecond * 0.000001);
        chart1.ResetAutoValues();
    }
    
    0 讨论(0)
提交回复
热议问题