I am having the following problem: I have a chart with two series and a time axis. The series are bound to collections of objects where one of the properties is DateTime. The CategoryDateTimeXAxis is bound to a third collection of DateTime instances.
If the two series have exactly the same number of elements, with the same values, as the X axis, everything works. However, if the axis has a different number of elements, the series are not displayed. If one of the collections has fewer elements, it is not displayed.
In short, unless the axis collection and the series collections line up exactly, the series are not displayed.
My expectation would be that the chart control lines up the data points in each series with the axis by comparing DateTime values. This does not appear to be happening.
I have set up the test project below. The first chart has the exact same elements in all 3 collections (DateTime values at 1 minute intervals). The second chart has the date axis bound to a collection with twice as many elements as the series (DateTime values at 30 second intervals). On the second chart nothing is displayed.
As an additional test, when I remove one element from one of the series, that series disappears from the chart:
Items2.RemoveAt(0);
Here is my code:
Hi Andrew,
I have several links for you but I think Graham described the issue you are seeing best on this link.
http://es.infragistics.com/community/forums/t/72339.aspx
This is Graham’s description of the issue.
when using the CategoryDateTimeXAxis, unless each series has exactly the same number of entries with the same dates in the same order, you should use a seperate CategoryDateTimeXAxis per series. You would then synchronize their ranges by using the MinimumValue and MaximumValue.
Since the CategoryDateTimeXAxis handles reordering of unordered data and auto-min/max, you can't share it between series unless their data alignment is identical.
Scroll down on this site and look for Graham Murray’s response and explanation concerning the CategoryDateTimeXAxis. http://es.infragistics.com/community/forums/p/71286/366652.aspx#366652
Here is another site where Stefan provides an explanation and a couple of samples that are using CategoryDateTimeXAxis with multiple series. http://es.infragistics.com/community/forums/t/78217.aspx?PageIndex=1
Remember that you will need to align the two Axes by setting MinimumValue and MaximumValue on each and you will also need to set the AxisLabelSetting Visibility to Collaped on one of the Axes.
If you need to eliminate a value for one of the Items collections, you can set the Value to Double.NaN while retaining the Time for your Item class.
Please let me know if you have any questions.