09-08-2016 03:38 AM
List<List<Point>> ps = new List<List<Point>>();//<List<Point>>(); int x = 0; private void Button_Click(object sender, RoutedEventArgs e) { for (int k = 0; k < ps.Count; k++) { List<Point> pp = new List<Point>(); for (int i = x; i < x + 100; i++) { for (int j = 0; j < 120; j++) { Point p = new Point(i, j); pp.Add(p); } } ps[k].AddRange(pp); } x += 100; graph.Refresh(false); } private void Window_Loaded(object sender, RoutedEventArgs e) { graph.DataSource = ps; for (int i = 0; i < 18; i++) { ps.Add(new List<Point>()); } }
When DataSource is used to pass data to a graph, you can pass false (False in Visual Basic) for reprocessUnchanged to only process new objects in the data source, or you can pass true (True in Visual Basic) for reprocessUnchanged to reprocess all items in the data source.
graph.Refresh(false); no display add data
Solved! Go to Solution.
09-08-2016 10:17 AM
The key term from the documentation you cited is "new objects". In your example ps
list always contains the same List<Point>
instances, so when the graph checks (pseudocode) "{old}ps[i].Equals( {new}ps[i] )" in Refresh(false)
, it always sees "the old and new instances are equal ⇒ no new objects, nothing to refresh".
If you want the graph to reprocess the same instances to check for new data, you would need to use Refresh()
/Refresh(true)
(or a data source that notifies when changes occur).