Synch Multiple Charts

May 26, 2010 at 3:21 PM
Edited May 26, 2010 at 4:39 PM

I have a working Isoline plot with my X,Y,Z data. I would like to make two additional line charts to represent the data as well (Chart 1: X,Z | Chart 2: Y, Z). I would also like to synchronize the view of the three plots so when I move my cursor or pan on any of the three charts, it updates the other two. I have seen in the discussions how to do this with charts of the same type, but in my case I have and IsoLine chart and two LineCharts. They IsoLineChart should act like the master so when you pan or move the cursor on it, the two line charts will update. It seems to me I need to bind each individual property to get this to work as binding the viewports and CCGs does not help.

How can I bind the X,Y,Z of the IsoLine graph to the X,Z of chart 1 and Y,Z of chart two, then synch the charts so panning works throughout? Thanks in advance. Here is some code I have that doesn't work.

 

        private void PopulateChartData(PhotoDataEventArgs photoDataEventArgs)
        {
            GraphsView graphsViewCast = View as GraphsView;
            WarpedDataSource2D<double> dataSource = new WarpedDataSource2D<double>(photoDataEventArgs.Data, photoDataEventArgs.GridData);
            graphsViewCast.isolineGraphIsoCandela.DataSource = dataSource;
            graphsViewCast.isolineGraphIsoCandela.DataSource = dataSource;

            Rect visible = dataSource.GetGridBounds();
            graphsViewCast.contourPlotter.Viewport.Visible = visible;

            graphsViewCast.horizontalAnglePlotter.Viewport.SetBinding(Viewport2D.VisibilityProperty, new Binding("Visible") { Source = graphsViewCast.contourPlotter.Viewport, Mode = BindingMode.TwoWay });
            graphsViewCast.verticalAnglePlotter.Viewport.SetBinding(Viewport2D.VisibilityProperty, new Binding("Visible") { Source = graphsViewCast.contourPlotter.Viewport, Mode = BindingMode.TwoWay });
        }

 

Jun 9, 2010 at 9:59 PM
Edited Jun 9, 2010 at 10:01 PM

Hi BBauer,

I havent actually tested this, but from looking at your code, I think there is a mistake.

Here:

graphsViewCast.horizontalAnglePlotter.Viewport.SetBinding(Viewport2D.VisibilityProperty, new Binding("Visible") { Source = graphsViewCast.contourPlotter.Viewport, Mode = BindingMode.TwoWay }

you are using the Viewport2D.VisibilityProperty. I think you want Viewport2D.VisibleProperty.

 

VisibilityProperty is what you use to show/hide/collapse the viewport. VisibleProperty is the dataRect of the visible data.

 

Also note that the Console is where you need to look for binding errors!