Hi
Is it possible to have 2 charts, one on the top the other, sharing the same x-axis and with the major/minor gridlines in sync (as in drawing straight lines through the 2 charts) ?
I have tried placing two charts one above the other and have the x-axis not shown for the chart on the above. but the x-axis major/minor gridlines do not match due to difference in intervals and their y-axes values.
Thankstungngie
Hello Tungngie,
Yes it is possible. There is a sample in the WPF DataVisualization Feature Browser showing exactly this kind of functionality. It is called “Chart Synchronization ” and you can find it under “xamDataChart” -> “Interaction” tags. It consists of 4 xamDataChart 3 of which are synchronized. You can see the blue and green chart doing what you need.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Hi Petar
I have tried using the Synchronization feature. I am able to get the zooming working, but not the grid lines in sync.
I have attached 2 screenshots below. Both are having the x-axis gridlines not in sync.
Hi Graham
The second screenshot that i posted has same Extent for y-axes. Extent = 20.
The y-axis lines matches, but the subsequent major and minor gridlines do not match.
What is the difference between Extent and Padding?
Extent is referring to the space allotted to the labels, it will be automatically calculated if you don't specify based on the width or height required by the labels, but in your case, since you want to syncronize the charts, you would prefer that the same width were used for each y-axis as in your later screenshot, so the approach is to also synchronize the width of these axes.
Now, when you are specifying that the charts be synchronized, you are really asking that their zoom level be synchronized, which won't necessarily guarantee that your axis lines match up if your axes are defined differently. Which axis type are you using? CategoryXAxis or CategoryDateTimeXAxis? If the former, do you have the same number of data points bound to each axis? If the latter, make sure you minimum and maximum points in the series have the same date time value for each series. The CategoryDateTimeXAxis does not require that there are the same number of points in both series, but you should make sure the minimum and maximum values align.
Its possible to assign the same CategoryXAxis to two charts, but it will still require that the series have the same number of data points to align properly, and it will currently only render the gridlines on one chart area.
Let me know if you have more questions.
-Graham
For both of the charts, i am using CategoryDateTimeXAxis. The x-axes are defined separately in each XamDataChart. Both these two series are having the same ItemsSource, hence they have the same points with maximum and minimum values align.
In the future, it maybe possible that i would need the two series to be aligned even though they have different points, with different minimum and maximum dates. But the two series will then be plotted with x-axes that has the minimum of the 2 minimum dates and maximum of the 2 maximum dates. Is this possible in XamDataChart? setting minimum and maximum date for CategoryDateTimeXAxis?
Is it possible to have XamDataChart to contain more than 1 ChartArea?
Oh, i am using XamDock to put my XamDataChart. Below shows my source code.
(lineChartPoints is an ObservableCollection)
Do let me know if you see any anomaly in my code.
tungngie,
This seems similar to a bug that has been reported (32129) and should be resolved in the next service release. I suspect it could have something to do with the fact that the column series uses slightly different rules for gridline placement than a series like the line series, due to the fact that multiple column series might be interleaved category-wize. But in the case of the CategoryDateTimeXAxis, this rendering style may be inappropriate.
Do you see the same behavior if you make the bottom series an area series, for example?
I believe we should add the ability to configure the Minimum and Maximum values of the CategoryDateTimeXAxis manually, to properly enable alignment scenarios such as this one for it. I'd imagine its already in the pipeline along with other features for this axis, but it probably couldn't hurt to vote for it with a feature request.
yup, same with area series. I have first tried it using Range Area series to plot the bottom series as i did not realise there is a column series.
Thanks for the reply, Graham. I look forward for the next release.tungngie