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

Multiplte Charts offsetting with same x axis values

Hello,

What i'm trying to do is fairly simple, i am trying to plot 2 or more plots on the same chart. I have it working as of now, but as you can see from the image, they are offset from each other. Their x values (which are date time values) are DIFFERENT as dont match up which is fine, so they wont be a one to one overlay. But they are acting like they are 2 totally different charts, the x axis date/times dont overlay,. Here is the data for these 2 series. Why dont the x axis for these 2 combine the charts automatically? The work around is to combine the data points so i add empty values for those date/times and drop them. But there could be a lot of series i want to plot so this could be very annoying to do. 


Attachment: chart_8ed9101a.zip

4 Replies 1 reply marked as answer

HK Hariharasudhan Kanagaraj Syncfusion Team March 17, 2023 04:05 PM UTC

Hi Jesse,


We have validated the shared data points, we noticed a second difference in both series data points. We suspect that you are using DateTimeCategoryAxis as the primary axis, and since the series are rendered with a different data source, they are only rendered separately.


You can resolve this issue using any of the following suggestions:


Use the same data source for both series and sets the primary axis as DateTimeCategoryAxis, it renders the series based on index.


OR        


If you cannot change the data source means, you can use the  DateTimeAxis for your current data points.


Kindly refer to the attached UG document regarding DateTimeAxis and DateTimeCategoryAxis for further information.


UG, https://help.syncfusion.com/flutter/cartesian-charts/axis-types#date-time-axis

UG, https://help.syncfusion.com/flutter/cartesian-charts/axis-types#date-time-category-axis


Thanks,

Hari Hara Sudhan. K


Marked as answer

JE Jesse replied to Hariharasudhan Kanagaraj March 17, 2023 04:12 PM UTC

Thanks for the quick reply! Il give this a shot and let you know. unfortunately I am reworking a lot of my main code so i can test this out just yet. But give me some time and il reply back when i have an update. 



JE Jesse March 18, 2023 03:06 PM UTC

Thanks! I was able to test this out. It works great now.  I ended up using the DateTimeAxis for the primaryxaxis setting and it works well now. 



YG Yuvaraj Gajaraj Syncfusion Team March 20, 2023 05:56 AM UTC

Most Welcome. Kindly get back to us if you have further queries. We are always happy to assist you.


Loader.
Up arrow icon