This project is read-only.

Sync visible area on multiple charts

Nov 2, 2009 at 2:28 PM

I have a need to synchronise the visible plot area of 2 charts where if you, for example, pan on one chart the other chart will also be panned. In it's simple form it means that the visible range on the X and Y axis are matched. Is there something built-in for this or do you have any tips on how to add this functionality?

Thanks.

Nov 3, 2009 at 4:08 AM

Hi!

The easiest way to do this - is to use two-way binding.

Supposing you have two chartPlotters named plotter1 and plotter2:

 

plotter1.Viewport.SetBinding(Viewport2D.VisibleProperty, new Binding("Visible"){Source=plotter2.Viewport, Mode=BindingMode.TwoWay});

Best regards,

Mikhail.

 

 

Nov 4, 2009 at 12:21 PM

Thanks, that works great!

It seems that Cursors like CursorCoordinateGraph are assigned to individual plotters. Is it possible to also synchronise the position of 2 cursors? So in the screenshot linked below, if I move the mouse on the top graph the cursor moves with it, what I'd like is for the bottom graph's cursor to also move and so be kept in line.

http://s906.photobucket.com/albums/ac266/McBainUK/?action=view&current=SyncCursor.jpg

Nov 8, 2009 at 5:54 PM

Hi,

To archive syncronisation of two CursorCoordinateGraphs (CCG further), you need:

1) Set AutoHide property of each CCGs. This will prevent elements from hiding when mouse leaves associated plotter.

2) Set a binding on Position property:

 

leftCursor.SetBinding(CursorCoordinateGraph.PositionProperty, new Binding
{
	Source = rightCursor,
	Path = new PropertyPath("Position"),
	Mode = BindingMode.TwoWay
});

where leftCursor and rightCursor are CCGs.

This should work.

Best regards,

Mikhail.

 

Nov 9, 2009 at 3:42 PM

Perfect. Thanks!