Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2085
How to display 2 different days on the same chart
posted

I have a requirement where I need to show 2 different 24 hour periods on the same chart.  The point of this is to show values for one day compared to values for a different day.  I've come up with one solution where I have an x-axis for each day that I want to graph, but ideally I would like to have 1 x-axis that has marks for each of the 24 hours in a day, and then graph the values I have based on the hour they occur in, not the date+hour.

We call this a day-over-day comparison, is there a straightforward way to do this using the XamDataChart?

  • 34810
    Verified Answer
    Offline posted

    Hello Gary,

    I have been investigating into this behavior that you are looking to achieve, and I have to wonder what your data looks like this case, and whether or not the interval at which your data is sampled is consistent. If it is, it may be possible to simply use a CategoryXAxis rather than a CategoryDateTimeXAxis, and store the hour which the data was sampled in a separate property on your data item.

    The category series of the XamDataChart do accept different data sources than are used with their category axis if the categories are the same in number and in value. If you can ensure this, whether that be by padding your underlying data source to include extra categories with double.NaN values for points that don't really "exist," or by simply sampling your data at fully consistent intervals, you can have a day-over-day plot using a single axis.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    XamDataChartMultiDayCase.zip