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,
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
Please let me know if you have any questions.
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.
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.
I hope the information I provided was helpful.