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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Vertical StripLines on a DateTimeAxis

Thread ID:

Created:

Updated:

Platform:

Replies:

143397 May 21,2017 03:08 PM UTC Mar 19,2019 11:36 AM UTC ASP.NET Web Forms 5
loading
Tags: Chart
RR
Asked On May 21, 2017 03:08 PM UTC

Is it possible? I can't figure out what start and width properties would be set to. 

Durgadevi Selvaraj [Syncfusion]
Replied On May 22, 2017 11:30 AM UTC

Hi Rosanne,

Thanks for contacting Syncfusion Support.

We would like to inform you that, it is possible to set ChartStripline to the DateTimeAxis by converting the corresponding datetime value to the
double value as like in the below code snippet,
 
DateTimeAxis datetimeaxis = new DateTimeAxis(); 
datetimeaxis.LabelFormat = "MMM"; 
chart.PrimaryAxis = datetimeaxis;  
 
ChartStripLine stripline = new ChartStripLine(); 
stripline.Start = new DateTime(2010, 04, 01).ToOADate(); 
stripline.Width = 91; 
stripline.Background = new SolidColorBrush(Colors.LightBlue); 
stripline.Opacity = 0.8; 
stripline.Label = "Quarter 2"; 
datetimeaxis.StripLines.Add(stripline); 
 
 













  
  
  
  
  
  
Please find the output screenshot, 

We have prepared a demo sample for your reference and it can be downloaded from below link,
Sample: VerticalStripLine_DateTimeAxis

Regards,

Durgadevi S 




Gijs
Replied On March 16, 2019 10:05 AM UTC

Hello, i was wondering how to do this in an asp.net core razor page.

Muneesh Kumar G [Syncfusion]
Replied On March 18, 2019 04:54 AM UTC

Hi Rosanne, 
 
Thanks for your update.  
 
You can achieve this requirement in Asp.Net core by adding stripline to axis’s striplines collection as per the below code snippet.  
 
Code snippet 
<ejs-chart id="container" width="60%"> 
        <e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis> 
        <e-chart-axes> 
            <e-chart-axis name="yAxis" valueType="Category"> 
                <e-striplines> 
                    <e-stripline visible="true" start="20" end="30" color="red"></e-stripline> 
                </e-striplines> 
            </e-chart-axis> 
        </e-chart-axes> 
        <e-series-collection> 
            <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" yAxisName="yAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series> 
        </e-series-collection> 
    </ejs-chart> 
 
 
Online samples:  
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 
 


Gijs
Replied On March 18, 2019 12:38 PM UTC

Hello thanks for the quick response. Can you provide an example were the primaryxaxis is of valuetype DATETIME instead of CATEGORY?
The primaryxaxis constists of 70 hours and I want to draw stripline on a specific hour..

Best regards,
Gijs

Dharanidharan Dharmasivam [Syncfusion]
Replied On March 19, 2019 11:36 AM UTC

Hi Rosanne, 
 
Thanks for the update. We have prepared a sample by rendering strip line with date time axis. Find the code snippet below to achieve this requirement and you can change this based on your requirement. 
 
 
<ejs-chart id="chartContainer" load="chartLoad"> 
    <e-chart-primaryxaxis valueType="DateTime"> 
        <e-primaryxaxis-striplines> 
            <e-primaryxaxis-stripline visible="true" text="Stripline" color="red"></e-primaryxaxis-stripline> 
        </e-primaryxaxis-striplines> 
    </e-chart-primaryxaxis> 
 </ejs-chart> 
 
function chartLoad(args) { 
        args.chart.primaryXAxis.stripLines[0].start = new Date(2019, 0, 4); 
        args.chart.primaryXAxis.stripLines[0].end = new Date(2019, 0, 5); 
    } 
 
 
Screenshot:  
 
 
 
Thanks, 
Dharani. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;