Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

WPF GRAPH refresh(false) ,no refresh

Solved!
Go to solution
   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>());
            }

        }

http://zone.ni.com/reference/en-XX/help/375857A-01/html/m_nationalinstruments_controls_primitives_gr...

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

0 Kudos
Message 1 of 2
(2,922 Views)
Solution
Accepted by topic author jiewei_li

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).

~ Paul H
0 Kudos
Message 2 of 2
(2,906 Views)