1

When you use a DataVisualization Chart object and you add points to it, the graph is automatically updated but when you change the points the chart is not updated. For example:

System.Windows.Forms.DataVisualization.Charting.Chart myChart;

// When you add points, the chart is automatically redrawn.
myChart.Series[0].Points.AddXY(0,0);
myChart.Series[0].Points.AddXY(1,1);
myChart.Series[0].Points.AddXY(2,0);

// When I change the value of points, the chart is not automatically redrawn.
myChart.Series[0].Points[0].SetValueXY(0,1);

How can I force a redraw of the chart? Something like myChart.Update() or something. As a workaround I'm deleting the last point and re-adding it at each update to force a redraw, but I would like something a little bit more elegant.:

// Re-add last point to force redraw.
myChart.Series[0].Points.RemoveAt(2);
myChart.Series[0].Points.AddXY(2,0);
Francois
  • 21
  • 3
  • possible duplicate of [MSDN charts changing point values realtime?](http://stackoverflow.com/questions/21909196/msdn-charts-changing-point-values-realtime) – mmathis Mar 04 '14 at 17:14
  • Yes, it is duplicate. Solution is myChart.Refresh(). Refresh() method does not show up in intellisense/autocomplete suggestions in Visual Studio 2010 but it does compile and run. – Francois Mar 05 '14 at 05:38

0 Answers0