Click here to Skip to main content
14,972,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have a program that displays a dynamically arriving data into a chart plotter as a line graph using the Dynamic Data Display Library. Now here's my question. I have a checkBox after checking which, the data should be erased and start plotting again. tried with plotter.Children.Remove(linegraph) method, but it doesn't exactly do a clearing of data and thus not useful in my case. Anyone came across this and has a solution for me? Here is the code example (includes some pseudo codes) that I have so far. By using this code, I am able to start plotting from start again, but the old points are still on display so the new points are being drawn on top of the old ones.
Thank you!

C#
ObservableDataSource<System.Windows.Point> source1=new ObservableDataSource<System.Windows.Point>();
LineGraph line1=new LineGraph(source1);
line1.Name = "Data1";
int i=0;
start a timer to CaptureData...
CaptureData(....,...)
{
  if a CheckBox is checked...()
 {
    if (i == 0)
    {
    plotter.Children.Add(line1);
    }
    double graph_x = Convert.ToDouble(i);
    double graph_y = Convert.ToDouble(datapoint that I have);
    System.Windows.Point p1 = new System.Windows.Point(graph_x, graph_y);
    source1.AppendAsync(Dispatcher, p1);
    i++;
    }
 }
 Once the checkBox is unchecked
 {
    if (i != 0)
      {
         i=0;
         plotter.Children.Remove(line1);
      }
 }
}
Posted
Updated 22-May-13 16:16pm
v5
Comments
narayaru 23-May-13 22:20pm
   
Hello anyone with a hint?? let me know if the question is not clear to you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900