Two Independent Axes with injected plotter does not work in latest nightly build

Aug 25, 2009 at 2:47 PM

Hi Mikhail,

I downloaded the latest nightly build and I found a problem with the injected plotter. If you run the DevSample TwoIndependentAxes you could see that the innerplotter does not draw in the screen, it does not show in the legend and the axis on the right side does not show neither.

I will revert back to my previous version 28448 where this demo was working ok, but I though that it would me nice to have this working again.

Regards,

Pedro

 

Editor
Aug 25, 2009 at 7:41 PM

Thanks, Pedro, this bug will be fixed in next changeset (tomorrow, probably).

Regards,

Mikhail.

Editor
Aug 26, 2009 at 3:46 PM

Hi,

fixed in changeset 28560.

Mikhail.

Aug 26, 2009 at 6:56 PM

Hi Mikhail,

I downloaded the latest build 28560. It fix the problem with the two axes sample but I found another problem with this build.

In my application I am drawing some LineGraph in the ChartPlotter and others LineGraph in the injectedPlotter as you do in the sample application. Sometimes I need to remove all the LineGraph from both the injectedPlotter and the ChartPlotter in order to redraw then with new values or different set of graphs.

The problem that I found is that when I tried to remove all the LineGraph from the ChartPlotter I got an exception "Invalid value of child's parent plotter - it should be equal to plotter that child is being removed from." in the Plotter.cs, method protected virtual void OnChildRemoving(IPlotterElement child).

I found that the problem is that after the new LineGraph are added to the injectedPlotter and these same LineGraph are added to the ChartPlotter but the parent still apears as the injectedPlotter, the function gets the exception when it tries to remove from the ChartPlotter one of the LineGraph that were added to the injectedPlotter.

I modified your TwoAxesSample demo to test if the problem was in my code. Basically I added a button and I put the following code in the click event.

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            innerPlotter.Children.RemoveAll<LineGraph>();
            plotter.Children.RemoveAll<LineGraph>();
        }

With this code I got the exception on the line plotter.Children.RemoveAll<LineGraph>();

I tried a different way to delete the LineGraph that avoid the exception but one LineGraph remains in the ChartPlotter even when I delete both from the from their actual parent. Please check the following code.

  List<LineGraph> graphList = new List<LineGraph>();

  private void Window1_Loaded(object sender, RoutedEventArgs e)
  {
   innerPlotter.SetVerticalTransform(0, 0, 124, 58);

   var rpms = Enumerable.Range(0, 9).Select(i => i * 1000.0).AsXDataSource();
   var hps = new double[] { 0, 24, 52, 74, 98, 112, 124, 122, 116 }.AsYDataSource();

   var horsePowersDS = rpms.Join(hps);

   LineGraph graph;
  

 graph = plotter.AddLineGraph(horsePowersDS, Colors.Red, 2, "HP per RPM");
            graphList.Add(graph);

   var torque = new double[] { 0, 22, 45, 54, 58, 55, 50, 47, 45 }.AsYDataSource();
   var torqueDS = rpms.Join(torque);

   graph = innerPlotter.AddLineGraph(torqueDS, Colors.Blue, 2, "Torque per RPM");

   graphList.Add(graph);

 }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < graphList.Count; i++)
            {
                if (graphList[i].Plotter == innerPlotter)
                    innerPlotter.Children.Remove(graphList[i]);

                if (graphList[i].Plotter == plotter)
                    plotter.Children.Remove(graphList[i]);
            }

            graphList.Clear();
        }
 }

I hope this help you to find the problem.

Thank you for your support.

Regards,

Pedro

 

Editor
Aug 27, 2009 at 5:24 PM
Edited Aug 27, 2009 at 6:24 PM

Hi Pedro, this is strange, but I was unable to reproduce exception you are talking about, though for me at first glance it looked reasonable and I thought that I'll have it, too.

So please try to use the latest version (there is one newer than 28560), or contact me in Skype - my id is mikhail.brinchuk

We'll try to reproduce this bug in interactive mode)

Best regards,

Mikhail.

Aug 27, 2009 at 9:22 PM

Hi Mihkail,

Actualy the error I found it on the latest Nightly build the 28560, I saw that you publish a new one today and I also tried with that one.

I got the same error, if I tried to delete all the LineGraph from the plotter and the injected plotter I got an exception.

private void button1_Click(object sender, RoutedEventArgs e)
        {
            innerPlotter.Children.RemoveAll<LineGraph>();
            plotter.Children.RemoveAll<LineGraph>();
        }

The innerPlotter.Children.RemoveAll does not fail, but it does not remove the LineGraph from the plotter, In release 28448 it works fine. When the plotter tries to remove those LineGraph it fails because he is not the parent.

I added you to my skype, looking forward to check this issue together.

Regards,

Pedro

 

 

Editor
Aug 30, 2009 at 3:35 PM

Hi Pedro,

I hope I've fixed this bug in the latest changeset 28606.

Please answer here if I am wrong and this bug is not actually fixed.

Best regards,

Mikhail.

Aug 31, 2009 at 6:08 PM

Hi Mikhail,

I download the latest change set 28606.

I was not able to compile that package due to missing files.

I used the dll that I found in Nightly build bin folder and with that one I seams that the bug it is fixed.

I would like to be able to compile from the source again, the new set it is missing files that do not allow to compile it properly.

Regards,

Pedro

 

Editor
Aug 31, 2009 at 6:57 PM

Sorry for this unbuildable changeset - there were some errors while uploading files.

Please check newly uploaded build - 28615

 

Best regards,

Mikhail.

Sep 1, 2009 at 3:19 PM

Hi Mikhail,

Thank you for the update. The Two Axes sample is working OK with the latest nightly build 28615 and it compiles OK.

Regards,

Pedro