We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Stacking Column series using CategoryAxis with date time rounds the DateTime to just the date to determine how to stack

So a typical thing to do is to use a CategoryAxis as the PrimaryAxis, and then use a DateTime as the XBindingPath which historically has resulted in a chart where you get one column for each datapoint without all the extra empty spaces you would end up if it was a DateTime Axis.   This works with SfChart for Xamarin Forms until you try to use a stacking column series where you may have multiple data points for one day, and a single data point for another day.  Instead of stacking items based on if they have an identical date time stamp, down to the second, it just stacks everything for date, ignoring the timestamp.

End result is instead of having multiple stacks for the day, you end up with one huge stack for everything that happened on that date.  Obviously this is a huge problem.  

Is there a setting to tell it how much it should round the datetime to when doing a stacking column series where the category is a datetime?

Thank you.

7 Replies

JD Jeff Dalby December 15, 2015 06:41 PM UTC

HOld off on looking into this.  I'm double checking my source data because it might have duplicates in it that aren't supposed to be there.


MK Magesh Kumar Krishnan Syncfusion Team December 16, 2015 05:40 AM UTC

Hi Jeff,

Thanks for contacting Syncfusion support. Please let us know if you need any technical assistance

Regards,
Magesh Kumar K


JD Jeff Dalby December 18, 2015 04:29 PM UTC

OK I've finally figured out what is happening.  It has nothing to do with a datetime, because it totally doesn't matter what you use as the X Axis.   Right now the Stacking Column Chart doesn't do any grouping at all like it used to.  Now, since our charts have to be a collection of ChartDataPoint (according to the online documentation), when you add multiple series to a Stacking Column Series all it does display the first item in each series as the first entry, second item in each as the second column, etc.  It doesn't matter what type of data you have as the XValue, because that isn't looked at in order to determine what should stack.

This obviously makes stacking column series pointless, and it's beyond impractical to expect a person to write code to manually line up each datapoint creating empty points where there is no data.   

When I attempt to use the Stacking Column like I did with WinRT it fails because it doesn't support complex bindings so there's no way to do the old way either.

Very frustrating.


MK Magesh Kumar Krishnan Syncfusion Team December 19, 2015 12:19 PM UTC

Hi Jeff,

Currently, the Stacked charts stacks its data’s based on the index of the data point for the CategoryAxis and based on the X Value of the data for the Numerical or DateTime axis. So, we have created a workaround sample for your requirement to stack the data based on the day. Please find the workaround from the following attachment.

http://www.syncfusion.com/downloads/support/forum/121443/ze/SimpleSample1384081311

Regards,
Magesh Kumar K


JD Jeff Dalby December 20, 2015 05:25 PM UTC

I apologize because it seems I've not been clear in the requirements.  I don't need dates to stack based on each day I need them to stack the same as a "DateTimeCategoryAxis" that other version can use.  The description you all have for that is: "DateTimeCategoryAxis is a special type of axis used mainly with financial series. All the data points are plotted with equal spaces, similar to CategoryAxis, thereby removing space for missing dates. Intervals and range for the axis are calculated similar to DateTimeAxis. There are no visual gaps between points, even when the difference between two points is more than a year."

The reason we don't use a DateTime Axis is we may have many data points sets in a single day which each need to show as a separate columns, and then there may not be any data for a couple of days, and then just one data point set, etc.  A DateTime axis would leave a lot of empty space we don't care about. We need a stacked column for each data set stacked based on them having an identical timestamp, so it shouldn't matter if there are 10 in a day or 0.  In the past the Stacked Column series would stack based on the X values matching (regardless of them being a DateTime, string, int whatever) which achieves this objective.   

I'm confused as to the reason for the change in behavior.  Having the Category Axis stack based on the index of the data point eliminates the possibility for any data set that has two or more series where the number of datapoints don't exactly align with each other.   Anyway, I'm looking for a way to modify your example to accomplish the same thing, but it seems to be a bit over my head.   

Thank you again for any assistance.  We chose Syncfusion because it can do both WinRT and Xamarin Forms, but it's certainly difficult to do this when they have completely different ways of accomplishing things.  We're getting close to needing to ship on Xamarin and right now the only things preventing us from doing so are this issue, and the issue with TreeMaps that we posted about before.  We do understand that Xamarin Forms is new to pretty much everyone, so again we appreciate any help you can give to let us achieve the same behavior between WinRT and Xamarin.


JD Jeff Dalby December 20, 2015 07:23 PM UTC

Well, I wasn't able to figure out a way to make your example work so that it matched everything by the timestamp, so instead I created a method to make all the indexes of the data points line up.  This solves my problem for now, but I do think you should consider adding the functionality back so it works the same as it used to.  Doing it this way increases the size of each series since I now have to add a bunch of data points with a value of 0 in order to get everything to line up.


MK Magesh Kumar Krishnan Syncfusion Team December 21, 2015 04:36 AM UTC

Hi Jeff,

We have created an incident under your Direct Trac account. Our support engineer will assist you through incident. So we request you to follow with the incident for further details.

Our Direct Trac support system can be accessed from the following link:
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,
Magesh Kumar k

Loader.
Up arrow icon