SfChart like Gantt chart

Hello!
I have demo application with chart. The chart has one datetime axis (from 00 to 24 hours with 1 hour unit) and one category axis. Also  I have dynamic number collections(Tracks) with times collection ( StartTime , EndTime and Duration - any time is different). Its quite similar to gantt. Also my application works in real time, so this chart should create dynamically. How I can create custom series or it is impossible? I dont want use gantt, because I have other problems with it.
  public interface IBaseTimeOperation
    {
        public BaseTrainOperationEnum BaseOperation { get; set; }

        public DateTime StartDate { get; set; }

        public DateTime EndDate { get; set; }

        public TimeSpan Duration { get; set; }

        public Status Status { get; set; }
    }


 public interface ITrackModel
    { ///
          public BindableCollection<
IBaseTimeOperation> Times { get; set; }
   ///  }    
public interface IStation
{///
  public BindableCollection<ITrackModel> Tracks { get; set; }}
///}


3 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team May 10, 2021 12:48 PM UTC

Hi Aksel Nielsen, 

We have achieved your requirement “SfChart like Gantt chart” with the help of RangeColumnSeries with enable IsTransposed property. And value provided datetime to double and formatting the axis label with the help of LabelCreated event for ChartAxis. Please find the Code example below. 

CodeSnippet
<syncfusion:SfChart>  

    <syncfusion:SfChart.PrimaryAxis> 
        <syncfusion:CategoryAxis /> 
    </syncfusion:SfChart.PrimaryAxis> 

    <syncfusion:SfChart.SecondaryAxis> 
        <syncfusion:NumericalAxis LabelCreated="NumericalAxis_LabelCreated" 
                                 /> 
    </syncfusion:SfChart.SecondaryAxis> 

    <syncfusion:SfChart.Series> 
        <syncfusion:RangeColumnSeries IsTransposed="True" 
                                      ItemsSource="{Binding DateTimeData}"  
                                      XBindingPath="CatValue" 
                                      High="StartDateTime" 
                                      Low="EndDateTime"> 
        </syncfusion:RangeColumnSeries> 
         
    </syncfusion:SfChart.Series> 
</syncfusion:SfChart> 

Also, we have attached the sample for your reference. Please find the sample from the below link. 
  
Output
 

For more details, please find the below link. 

Regards, 
Yuvaraj 



AN Aksel Nielsen May 10, 2021 01:47 PM UTC

Thank You for the answer, but  unfortunately that's not what i need.
In the picture below, I has drawn what I need approximately as a result. One category has multiple ranges.   


YP Yuvaraj Palanisamy Syncfusion Team May 11, 2021 10:25 AM UTC

Hi Aksel Nielsen, 
 
We have achieved your requirement “Category axis with multiple datapoint ” with the help of IsIndexed property of CategoryAxis to False. Please find the Code example below. 
 
CodeSnippet: 
<syncfusion:SfChart.PrimaryAxis> 
    <syncfusion:CategoryAxis IsIndexed="False"/> 
</syncfusion:SfChart.PrimaryAxis> 
 
Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
Output: 
 
 
For more details, please find the below link. 
 
Regards, 
Yuvaraj 


Marked as answer
Loader.
Up arrow icon