Sync two charts with DataFollowChart's

Apr 4, 2010 at 10:30 PM
Edited Apr 4, 2010 at 10:36 PM



First of all congratulations on that impressive and fantastic chart library, especially of it’s very high performance, probably the best in class – good job! I’m working with it more than a week and I’m still amazed. However, I have few problems/questions and any help will be appreciated. I have prepared a screenshot and sample solution project of main, first problem, so I hope it helps to understand what I’m trying to do J (links below)


1)      I want to synchronize two charts with each other  in order to have synchronized zoom, pan, vertical line (which is moving on mouse cursor move) and all of that with using DataFollowChart’s in both ChartPlotter’s.

Scenario: I have 2 ChartPlotter’s, which contain (each of them) 1 LineGraph; these plotter’s have common main horizontal DateTimeAxis, but first plotter has standart double-value vertical axis and second plotter has integer-value vertical axis. Both of them have also specific ViewportRestriction – first has yMin = 0, yMax = 10 and second has yMin = 0, yMax = 5; each of LineGraph have also additional DataFollowChart to provide actual mouse over value of them;  in both charts is also vertical line similar to cursor coordinate graph – ofcource synchronized with these two charts; outside of charts there are three TextBlock, which are bindend accordingly to current X-axis value, first plotter Y-axis value, second plotter Y-axis value; when everything is configured, project is running, a I press a button and it loads data source to first and second LineGraph – for data source I use DataTable object – and automaticaly it sets Domain of each plotter to “FitToView” DataRect rectangle; 

Solution (which I found on this forum) to synchronize Viewport through binding Viewport of first plotter to second plotter is good, but it works only if we haven’t set different ViewportRestriction on some axis – in my case we have a situation, which for first plotter yMax is 10 and for second yMax is 5, so when I zoom a little bit on edge of plotter area and then try to make a move out of data domain on second plotter I get effect of resizing first, binded plotter, like I would try to zooming it -> see screenshot . On the other hand vertical line, which is binded to first plotter LineGraph-DataFollowChart doesn’t move if mouse is moving on second plotter area – which is obvious of course and the solution of this is propably create a CursorCoordinateGraph (CCG) (like I also found here on forum), but a question is how to remove from it panel with current x-axis value? Also mayby make that CCG invisible and just bind HorizontalLine value property to that CCG value? And the last thing is that DataFollowChart isn’t follow data, when mouse is outside of current plotter area, so how to obtain refreshing data in bindend text property of TextBlock outside of chart on mouse move in second plotter? (see example project )


2)      Second question is rather question than problem, and it’s strong connected with first problem: is possible to get moving that HorizotnalLine on both charts even if mouse cursor is actual between these charts, practically on GridSplitter area, which height is some of 10 pixels – it’s quite important, because we are getting HorizontalLine “jump-effect”, when we move it from one plotter to another through that GridSplitter area, in which we move it around x-axis, for example we are getting out form first plot on x-value equal to 10 and we move mouse (over the GridSplitter area) to x-value 8 and then we move in mouse cursor to second plotter then HorizontalLine will “jump” from value 10 to 8 and that will be very smoothless.


3)      This question is propably for now out of any solution, although I’ll try to ask for it: is there any way to dynamically change a ONE LineGraph line color? The point is, that I bind a data source with for example boolean column, and I’m going to draw that LineGraph with color binded to current bool value,  e.g. true – line color from current point to point is blue, false – color is red. I found solution to draw as many line graphs as we have color changes, but if we can be serious – that kind approuch isn’t very efficient...


4)      Last question/problem is related with maximal drawing line length in plotter/wpf. If I have for example data source with 1 year length (HorizontalDateTimeAxis) and I have only a couple of value points in that year-length source and I want to zoom plotter to see particular second I’m getting my line invisible already in 7-days view. Like I have read yet it’s connected with wpf ability to drawing long (short) lines and the solution is to use DirectX, so I was trying to compile and run Line3D sample from nightly build pack, but unfortunatelly without success – project is compiling, but it won’t run (I’m getting xaml parser exception without any concrete information). Any suggestions?


Best regards,