Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Chart Control Auto Scroll/Disable Auto Scale

I am current building an application that graphs streaming data. I can receive and add data points to the chart just fine, but after every point is added, the graph alters its scale to include all the data points automatically(ie. the points get closer together as more are added). How can I turn this off?

Ideally, I would like the graph to simply scroll along the x axis rather than setting the scale each time a point is added. What is the best way to do this?

Here is the code I use for adding a data point as data arrives on the serial port:

chart1.Series["Series1"].Points.AddY(parsed);

The graph is just a default fast line plot. Here are screen captures of the graph plotting data over time. As you can see, it just compresses the graph over time rather than just leaving the scale alone and scrolling to the right. After a few seconds After a few more seconds

like image 634
isometrik Avatar asked Dec 14 '25 14:12

isometrik


1 Answers

This will disable auto-scaling:

chart1.ChartAreas[0].AxisY.ScaleBreakStyle.Enabled = false;
chart1.ChartAreas[0].AxisY.Maximum = 0.3;
chart1.ChartAreas[0].AxisY.Minimum = -0.3;
like image 190
Anton Andreev Avatar answered Dec 17 '25 15:12

Anton Andreev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!