How to clear plot window for new data

Jul 16, 2010 at 5:28 PM

Currently when I resend data to my plotter,  my legend keeps appending the new calls.- and the plot window fills with overwritten data ?

Whats a suggested way to clean out just the last plotted data and legend  ?

( assume I reload the arrays )

 

 MyHeader.Content = (object)"Number of data points " + theSize.ToString();
        
          var evelopeXaxisSource = new EnumerableDataSource<double>(xaxis);  // xaxis feed //
          evelopeXaxisSource.SetXMapping(x => x);
          var envelHiLimitsSource = new EnumerableDataSource<double>(HiLimits);
          envelHiLimitsSource.SetYMapping(y => y);
          var envelLoLimitsSource = new EnumerableDataSource<double>(LoLimits);
          envelLoLimitsSource.SetYMapping(y => y);
         CompositeDataSource compositeDateSource1 = new CompositeDataSource(evelopeXaxisSource, envelHiLimitsSource);
         CompositeDataSource compositeDateSource2 = new CompositeDataSource(evelopeXaxisSource, envelLoLimitsSource);

          //

          var indepXaxisSource = new EnumerableDataSource<double>(xindeps);  // xaxis feed //
          indepXaxisSource.SetXMapping(x => x);
          var SensorSource = new EnumerableDataSource<double>(SensVals);  // xaxis feed //
          SensorSource.SetYMapping(y => y);
          CompositeDataSource compositeDateSource3 = new CompositeDataSource(indepXaxisSource, SensorSource);

          // how do I clear legend ? and clean screen  ?
        
        
          plotter.AddLineGraph(compositeDateSource1, new Pen(Brushes.Green, 2), new CirclePointMarker { Size = 7.0, Fill = Brushes.GreenYellow }, new PenDescription("High Limit"));
          plotter.AddLineGraph(compositeDateSource2, new Pen(Brushes.Green, 2), new CirclePointMarker { Size = 7.0, Fill = Brushes.GreenYellow }, new PenDescription("Low Limit"));
          plotter.AddLineGraph(compositeDateSource3, new Pen(Brushes.Red, 2), new CirclePointMarker { Size = 5.0, Fill = Brushes.Red }, new PenDescription("SensorName"));
          plotter.Viewport.FitToView();

Jul 17, 2010 at 12:16 AM
Edited Jul 17, 2010 at 12:32 AM

The way I do this is to store the LineGraph/MarkerGraph object pair that is returned by plotter.AddLineGraph. When you no longer want the data plotted, just remove the stored object from the plotter children collection.

 e.g.

var graph = plotter.AddLineGraph(compositeDateSource1, new Pen(Brushes.Green, 2), new CirclePointMarker { Size = 7.0, Fill = Brushes.GreenYellow }, new PenDescription("High Limit")); 

...... 

plotter.Children.Remove(graph.LineGraph);
plotter.Children.Remove(graph.MarkerGraph);

 or if you are using the "Nightly" version of D3, you can remove all linegraphs with:

plotter.Children.RemoveAll<LineGraph>();
plotter.Children.RemoveAll<MarkerPointsGraph>();  
Jul 17, 2010 at 4:25 AM

Thank you for the reply !

When I tried to use

plotter.Children.RemoveAll<LineGraph>();

It wants Type in the pass parameter....

Based on what you said I must have something less than the nightly build.

I then tried the other method - which requires I keep a history of what is loaded - and it did work !!!

Another side question, is I downloaded the documentation CHM help file and it pointed to some URL that was inactive or could not be displayed - the index was there, but no content.

Any ideas ? Thanks

 

Jul 17, 2010 at 6:05 AM

Sounds like you are using the "Recommended Download".  I think most people use the most recent version (from late 2009) which is available from http://dynamicdatadisplay.codeplex.com/SourceControl/list/changesets

Yes, I get the same problem with the documentation.  The documentation is just generated from the source code so it's not all that helpful.

Jul 17, 2010 at 4:34 PM

Thanks grantnz.   Within dynamicdatadisplay-31108.zip I did not see the binary -DynamicDataDisplay.dll  -

I did see other DLL's- ShaderBuildTask.DLL & DynamicDataDisplay Sources v0.34703.0.zip & that contains a number of DLL's including WPFToolKit & System.Windows.Controls.DataVisualization DLL; SlimDX.dll

Does that mean your reference to most people are compiling the source code for create their own ( and possibly  variant ) version ? I  assumed that was what was needed.

I did find a sln\DynamicDataDisplay\DynamicDataDisplay.sln file - it did say build succeeded, and I have a new file to test

 

I renamed the old DLL & copied the revised DLL to where my project looked

When I rebuilt my project I have this error - Error    1    The tag 'ChartPlotter.HorizontalAxis' does not exist in XML namespace 'http://research.microsoft.com/DynamicDataDisplay/1.0'. Line 9 Position 18.    C:\....\my documents\visual studio 2010\Projects\WpfApplicationTestBed\WpfApplicationTestBed\MainWindow.xaml    9    18    WpfApplicationTestBed

 

    <d3:ChartPlotter.HorizontalAxis>
                    <d3:HorizontalAxis Name="IndepAxis"> </d3:HorizontalAxis>
                    
                </d3:ChartPlotter.HorizontalAxis>

ChartPlotter.HorizontalAxis shows on the intellisense. There must be a mix of components when the project rebuilt,  Any idea on what I also need besides the DLL ?

Thanks !

Jul 18, 2010 at 8:24 AM
Andrew, There have been a few changes between the "Recommended" build and the latest one. One of the changes is that HorizontalAxis was renamed MainHorizontalAxis. Just add the "Main" prefix and you should be okay. Not sure why Intellisense still think HorizontalAxis exists. Grant.
Jul 19, 2010 at 2:19 PM

Hi Grant !

Yes I see MainHorizontalAxis now, and no longer Horizontal - ditto for VerticleAxis -> MainVerticleAxis. 

This morning after trying to type in Main, it told me the designer needed to be reloaded and then it seemed to rectify the intellisense issue.

But yes there is one more strange issue - the first time I load I get 2 legends - However on repeat calls, just one legend. The bonus legend is on the top left.

My code that calls to load & display the first time is identical, as far as I can tell, that will execute the subsequent calls. ( just a button event ).

The only change I can think that happened is the recompiled DLL that support     plotter.Children.RemoveAll<LineGraph>(); & MainHorizontalAxis

Thanks ! Andrew

Jul 19, 2010 at 9:09 PM

Andrew,

The 2nd legend is imaginatively called "NewLegend".  You can hide it with:

<d3:ChartPlotter NewLegendVisible="False" >

Alternatively,  you can hide the "old" legend with

LegendVisibility="Collapsed"

and use the new one which has some extra features that give you more control of the legend display.

For example, I use it when I don't want all of the LineGraphs to have a legend entry.

Grant.

 

Jul 19, 2010 at 10:10 PM

Hi Grant !


Fanatastic !  Thanks for the quick reply your suggestion works great  !

typically data builds to the right in my work, so placing the legend to the top left is actually a better spot