0
votes

I am using MS Chart on WinForm to generate a realtime chart. This chart has a feature where user can save and load chart data to and from an xml file. To Save and load this data I am using Chart.Serializer.Save() and Chart.Serializer.Load() methods. These methods seem to be doing save and load correctly.

To Zoom the chart I use following code that works fine if I am working on the real-time data that cames straight from the server:

_chart.ChartAreas.SuspendUpdates();
_chartArea.AxisX.ScaleView.Zoom(_chartArea.AxisX.ScaleView.ViewMinimum + _zoomValue, _chartArea.AxisX.ScaleView.ViewMaximum - _zoomValue);
_chart.ChartAreas.ResumeUpdates();

But the above code doesn't work if I load the saved chart data. I compared the real-time and saved data and the values don't have anything different that should break this feature.

Any thoughts?

1

1 Answers

0
votes

Make sure that you restored event handlers after deserializing. For instance, set a breakpoint to the code above.

UPDATE
Try to set the following properties of the serializer:

_chart.Serializer.Content = SerializationContents.Data;
_chart.Serializer.IsResetWhenLoading = false;