How to show only date on datetime axis but also not group points with the same date but different times

Hello,

Currently, I am using a CategoryAxis with arrangebyindex set to false. I am using dates as strings such as "8/7/21". This way, all of the points on my scatter plot with the same date are on the same value on the x axis. 

However, I am trying to figure out a way to still show the date strings "8/7/21" as the units on the x axis, but if points have the same date but different times, I wan't them to have separate x values.

For example, if I have 3 objects:

  1. Datetime = 8/7/21 10:30AM
  2. Datetime = 8/7/21 10:30AM
  3. Datetime = 8/7/21 3:00PM
I would want 1 and 2 to be on the same value for the x axis and 3 would be on a different value. But I would want both labeled "8/7/21".

I was trying multiple ways with the date time axis but couldn't seem to get it to work.

Is there a good way for me to achieve this functionality?

Thanks,

David


1 Reply

YP Yuvaraj Palanisamy Syncfusion Team August 11, 2021 03:07 PM UTC

 
Greetings from Syncfusion. 
 
We have analyzed your query and scatter segment rendered with DateTimeAxis for same X-value in the same line. And the axis labels are rendered based on the nice interval calculation of the range. And also,  string type does not support for DateTimeAxis, we can provide only the DateTime value. 
 
Code Snippet: 
<chart:SfChart.PrimaryAxis> 
    <chart:DateTimeAxis PlotOffset="10" > 
        <chart:DateTimeAxis.Title> 
            <chart:ChartAxisTitle Text="DateTimeAxis"/>  
        </chart:DateTimeAxis.Title> 
    </chart:DateTimeAxis> 
</chart:SfChart.PrimaryAxis> 
 
Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
  
Output: 
 
 
For more details, please refer the below link. 
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon