08-24-2022 09:01 PM
Deer All:
I want to draw multiple curves on a graph. The number of curves is a variable. So I adopted the method of list < point > assignment. This method is time-consuming when the amount of data is large.
Graph.Data[Chn++] = List<Point> ;
Solved! Go to Solution.
08-25-2022 05:01 PM - edited 08-25-2022 05:02 PM
Assigning each data item individually is probably causing the graph to do some redundant re-processing as each item is assigned.
You can inform the graph about multiple updates by using the standard WPF BeginInit
/EndInit
methods:
Graph.BeginInit();
/* your existing code:
... Graph.Data[Chn++] = List<Point> ; ...
*/
Graph.EndInit();
Or you could assign all of the data to the graph at once:
var allChannelData = new List<List<Point>>();
/* your existing code, using new collection:
... allChannelData.Add( List<Point> ); ...
*/
graph.Data.AddRange( allChannelData );
// or alternatively, graph.DataSource = allChannelData;
I would also suggest comparing your graph configuration with the recommendations in the "Optimizing the WPF Graphs" help topic.
08-25-2022 08:03 PM