Hi, This is related to the case CAS-158629-F3J0W8. I have two line series with data for one series from last 3 months and the data for second series from last 1 month. When I try to plot the two series using one CategoryXAxis the series with more data gets cropped to the window for which I have data for the shorter series. E.g. attached IMG2.png is how the data appears where IMG1.png is how I would like it to appear.Also please note that I am using the sample that was provided as part of my previous case CAS-158097-G4L3G1 so I cannot use a CategoryDateTimeAxis.Thank you
Image 2
Hi Mohit,
Something you need to keep in mind is that if you are going to share the same CategoryXAxis between multiple series, the CategoryXAxis needs to be bound to a collection that includes all of the data points needed to display all of your series. Then you need to take your individual series data and add the correct number of data points needed in order to position the data in the appropriate location on the X axis, filling in these unused points with double.NaN. This is due to the way the data points are laid out on the axis.
Take a look at my attached sample. You will see two charts. The top chart is what it looks like with two LineSeries sharing the same CategoryXAxis where each series contains their own set of data points. You will see that the larger three month data fills the entire width of the chart. This is because I bound the CategoryXAxis to the three month data set. Now look at the smaller line series. This is the 1 month data set and internally it's starting data is completely different but a category series doesn't care about this. It will just look at the ItemsSource and render each data point starting on the left side of the chart. That is why the one month data is pictured on the left side regardless of what the starting date is.
To position the one month data in the appropriate spot you need to add more points to the ItemsSource until it has the same number of points as the three month data. The unused points you would set to double.NaN. This tells the chart to ignore those points. The end result is that I pushed the one month data set to the right so that it represents the past one months worth of data in the chart.
Hopefully this makes sense. Let me know if you have any questions on this.