This project is read-only.

TwoIndependentAxis and live data - Main axis follows injected plotter

Jan 6, 2011 at 12:59 PM


I'm having trouble with the multiple Y axis in the TwoIndependentAxis sample when the graphs are continously updated. I'm not sure where, exactly, the problem kicks in.

The problem is, the main Y axis seems to scale to contain the injected graph. If main graph is values 0-3 and injected graph is 0-100, the main axis scales to 0-100 so the graph is almost flat. It works when i run the sample as-is. The expected result is that main (left axis) is ~0-3 and right axis is 0-100+

I added this code to the sample for testing purposes:


        ObservableDataSource<Point> horsePowersDS;
        ObservableDataSource<Point> torqueDS;

void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
            torqueDS.AppendAsync(Dispatcher, new Point(cnt, Math.Pow(cnt, 1.1)));
            horsePowersDS.AppendAsync(Dispatcher,new Point(cnt, (cnt % 3)));


private void Window1_Loaded(object sender, RoutedEventArgs e)
            torqueDS = new ObservableDataSource<Point>();
            horsePowersDS = new ObservableDataSource<Point>();

            timer = new System.Timers.Timer(100);

            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            timer.AutoReset = true;

            plotter.AddLineGraph(horsePowersDS, Colors.Red, 2, "HP per RPM");
            var line = innerPlotter.AddLineGraph(torqueDS, Colors.Blue, 2, "Torque per RPM");

I realize this is not the place for c# support, so if I have done something terribly wrong, just show me the door ;) This way of using AppendAsync seems to drop samples when gui is busy, but this is not my actual implementation and just a sample.