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.
I hope the information I provided was helpful.
I had seen those two posts before. If you look at my code, you will see that I am using a separate X axis for each series, and that they have the same minimum and maximum. Despite this, if the series do not have they exact same number of items, they are not displayed.
As an additional comment, having to curate my series and axis data sources so that they have the same number of elements is silly and negates the whole point of using a charting component. You should modify this behavior. My expectation would be that if a date-time axis is used, the charting component lines up the elements of the series with the axis, regardless of how many elements they have, and the axis settings (min/max) control how much of each series is visible at any given time.
Did that sample and links help?
Please let me know if you have further questions.
I had already created a sample from your code but I’m made some modifications that may be helpful to you. The changes I made were to use a single chart and show both the TimeMinutes and TimeSeconds as CategoryDateTimeXAxis on the same chart, each with multiple LineSeries.
You’ll see that for each CategoryDateTimeXAxis there is a corresponding NumericYAxis.
And when it comes to the data the items in the Series corresponds to the items in the Axis collections. In other words if I needed to remove an item from item1 collection, I also removed it from Items2 and from the TimeMinutes collections. The other option was to set an item’s value to Double.NaN.
Here are two links where they are discussing performance comparisons and efficiencies that are part of the CategoryDateTimeXAxis and why.
http://es.infragistics.com/community/forums/t/59983.aspx
http://es.infragistics.com/community/forums/t/57637.aspx