How does Series.Points.Add method triger the redraw of the chart contol?
Question
When using the Chart control, invoking the Add
method to add new data point, such as Series.Points.AddXY()
, will trigger a redraw of the chart control. Now, I am trying to build a chart control by myself. I am wondering; how does it work. Is it using events and delegates or some other way to trigger the redraw?
Any hint would be appreciated.
Solution
You would do this by creating your own class that inherits Collection<T>
and overrides InsertItem()
and other methods to redraw the chart when the collection is changed.
OTHER TIPS
Why not just put the Refresh function inside the Series.Points.AddXY() function?
You probably want to be able to turn 'auto refresh' off in case someone wants to add 1,000 points one-by-one....the redrawing would kill performance.