Vertical date line separator

Hi there, Sync team!
I'm looking to create a vertical separator for my chart like  this:

Is that possible?


3 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team December 15, 2020 12:49 PM UTC

Hi Jorge Valenzuela,  
   
Greetings from Syncfusion.  
  
This update is mainly to get the confirmation of your requirement whether is to get the separate line for each day. If then, you can achieve this by adding the XAxis property of Series.  
    
<chart:SfChart.PrimaryAxis>  
    <chart:DateTimeAxis Interval="1"  
                        Minimum="{Binding MinimumDate}"  
                        Maximum="{Binding MaximumDate}"  
                        IntervalType="Days"  
                        OpposedPosition="True"  
                        ShowMajorGridLines="True"  
                        ShowMinorGridLines="False"  
                        EdgeLabelsDrawingMode="Fit">  
        <chart:DateTimeAxis.LabelStyle>  
            <chart:ChartAxisLabelStyle TextColor="Black" FontSize="12" LabelAlignment="End" Margin="10, 0, 0, 0" LabelFormat="MMM dd"/>  
        </chart:DateTimeAxis.LabelStyle>  
        <chart:DateTimeAxis.MajorGridLineStyle>  
            <chart:ChartLineStyle StrokeColor="Black" StrokeWidth="2"/>  
        </chart:DateTimeAxis.MajorGridLineStyle>  
        <chart:DateTimeAxis.MajorTickStyle>  
            <chart:ChartAxisTickStyle StrokeColor="Black" StrokeWidth="2" TickSize="10"/>  
        </chart:DateTimeAxis.MajorTickStyle>  
    </chart:DateTimeAxis>  
</chart:SfChart.PrimaryAxis>  
   
. . .  
   
<chart:FastLineSeries x:Name="lineSeries"  
                  ItemsSource="{Binding Data}"  
                  XBindingPath="XValue"  
                  YBindingPath="Height">  
    <chart:FastLineSeries.XAxis>  
        <chart:DateTimeAxis x:Name="xAxis" ShowTrackballInfo="True"  EdgeLabelsDrawingMode="Shift">  
            <chart:DateTimeAxis.LabelStyle>  
                <chart:ChartAxisLabelStyle LabelFormat="HH:mm"/>  
            </chart:DateTimeAxis.LabelStyle>  
        </chart:DateTimeAxis>  
    </chart:FastLineSeries.XAxis>  
    <chart:FastLineSeries.DataMarker>  
        <chart:ChartDataMarker ShowLabel="False" ShowMarker="True"/>  
    </chart:FastLineSeries.DataMarker>  
    <chart:FastLineSeries.ColorModel>  
        <chart:ChartColorModel Palette="Custom"/>  
    </chart:FastLineSeries.ColorModel>  
</chart:FastLineSeries>  
   
   
   
Also, we have prepared the sample for your reference. Please find the sample from the below link.  
   
  
Output:  


In case of misunderstanding your query, please explain that in detailed to ensure at our end and provide a proper solution at earlier. 
 
 
Regards, 
Yuvaraj. 



JV Jorge Valenzuela replied to Yuvaraj Palanisamy December 18, 2020 12:29 AM UTC

Hi Jorge Valenzuela,  
   
Greetings from Syncfusion.  
  
This update is mainly to get the confirmation of your requirement whether is to get the separate line for each day. If then, you can achieve this by adding the XAxis property of Series.  
    
<chart:SfChart.PrimaryAxis>  
    <chart:DateTimeAxis Interval="1"  
                        Minimum="{Binding MinimumDate}"  
                        Maximum="{Binding MaximumDate}"  
                        IntervalType="Days"  
                        OpposedPosition="True"  
                        ShowMajorGridLines="True"  
                        ShowMinorGridLines="False"  
                        EdgeLabelsDrawingMode="Fit">  
        <chart:DateTimeAxis.LabelStyle>  
            <chart:ChartAxisLabelStyle TextColor="Black" FontSize="12" LabelAlignment="End" Margin="10, 0, 0, 0" LabelFormat="MMM dd"/>  
        </chart:DateTimeAxis.LabelStyle>  
        <chart:DateTimeAxis.MajorGridLineStyle>  
            <chart:ChartLineStyle StrokeColor="Black" StrokeWidth="2"/>  
        </chart:DateTimeAxis.MajorGridLineStyle>  
        <chart:DateTimeAxis.MajorTickStyle>  
            <chart:ChartAxisTickStyle StrokeColor="Black" StrokeWidth="2" TickSize="10"/>  
        </chart:DateTimeAxis.MajorTickStyle>  
    </chart:DateTimeAxis>  
</chart:SfChart.PrimaryAxis>  
   
. . .  
   
<chart:FastLineSeries x:Name="lineSeries"  
                  ItemsSource="{Binding Data}"  
                  XBindingPath="XValue"  
                  YBindingPath="Height">  
    <chart:FastLineSeries.XAxis>  
        <chart:DateTimeAxis x:Name="xAxis" ShowTrackballInfo="True"  EdgeLabelsDrawingMode="Shift">  
            <chart:DateTimeAxis.LabelStyle>  
                <chart:ChartAxisLabelStyle LabelFormat="HH:mm"/>  
            </chart:DateTimeAxis.LabelStyle>  
        </chart:DateTimeAxis>  
    </chart:FastLineSeries.XAxis>  
    <chart:FastLineSeries.DataMarker>  
        <chart:ChartDataMarker ShowLabel="False" ShowMarker="True"/>  
    </chart:FastLineSeries.DataMarker>  
    <chart:FastLineSeries.ColorModel>  
        <chart:ChartColorModel Palette="Custom"/>  
    </chart:FastLineSeries.ColorModel>  
</chart:FastLineSeries>  
   
   
   
Also, we have prepared the sample for your reference. Please find the sample from the below link.  
   
  
Output:  


In case of misunderstanding your query, please explain that in detailed to ensure at our end and provide a proper solution at earlier. 
 
 
Regards, 
Yuvaraj. 


Yeah, this seems nice, but can I decide which lines show?
My chart only shows the information from 24 hours, so I need to show only one line that will be indicated the 12 am.


YP Yuvaraj Palanisamy Syncfusion Team December 18, 2020 08:30 AM UTC

 
#Solution 1 - Chart have only 24 hours 
 
As per your requirement “Line shows at 12.AM with chart have only 24 hours data” we have achieved by using Interval and Interval type property of DateTimeAxis. Also, we have modified the sample for your reference. Please find the sample from the below link. 
 
  
Output: 
 
 
#Solution 2 – Chart have more DataPoints and Shows only 24 hours. 
 
We have achieved your requirement with more number of datapoints and chart shows only 24 hours data by using AutoScrollingDelta and AutoScrollingDeltaType property of DateTimeAxis. And scroll the chart to view the previous datapoints by adding ChartZoomPanbehavior. 
 
Also, please find the sample from the below link. 
 
  
Output: 
 
 
For more details, please refer the below link. 
 
 
Regards, 
Yuvaraj. 


Marked as answer
Loader.
Up arrow icon