Use RangeColumn to display DateTime ranges.

Hello,

I would like to create a chart which will show time ranges according to the groups. So X axis should be DateTime and Y axis is a category (or double). See the picture.



Best regards,
Volodymyr

1 Reply 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team May 6, 2021 12:45 PM UTC

Hi Vladimir, 

Greetings from Syncfusion. 

We have analyzed your query with attached screenshot. We suggest you to specify X axis as Category type and Y axis as Double type since it doesn’t support DateTime type, for this you can assign milliseconds value to Y and customize its labels using OnAxisLabelRender event. We have attached sample for your reference. 

Code Snippet : 

<SfChart IsTransposed="true"> 
    <ChartEvents OnAxisLabelRender="LabelRender"></ChartEvents> 
</SfChart> 
@code{ 
    public void LabelRender(AxisLabelRenderEventArgs Args) 
    { 
        if(Args.Axis.Name == "PrimaryYAxis") 
        { 
            Args.Text = ((new DateTime(1970, 1, 1)).AddMilliseconds(double.Parse(Args.Text))).ToString().Split(' ')[0]; 
        } 
    } 
} 

Screenshot : 

 



Kindly revert us if you have any concerns. 

Regards, 
Durga G

Marked as answer
Loader.
Up arrow icon