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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Vertical StripLines on a DateTimeAxis

Thread ID:





143397 May 21,2017 03:08 PM UTC Feb 12,2021 05:03 AM UTC ASP.NET Web Forms 7
Tags: Chart
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"; 

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


Durgadevi S 

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-axis name="yAxis" valueType="Category"> 
                    <e-stripline visible="true" start="20" end="30" color="red"></e-stripline> 
            <e-series dataSource="ViewBag.dataSource" xName="x" yName="y" yAxisName="yAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series> 
Online samples:  
Please let us know if you have any queries.  
Muneesh Kumar G. 

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,

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-stripline visible="true" text="Stripline" color="red"></e-primaryxaxis-stripline> 
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); 

Replied On February 11, 2021 06:29 PM UTC

Whenever I try this approach I get the following error 

"System.ArgumentException: 'Object of type 'Syncfusion.EJ2.PivotView.PivotViewStripLine' cannot be converted to type 'Syncfusion.EJ2.Charts.ChartStripLine'.'"

This is our  XAxis markup

<e-chart-primaryxaxis edgeLabelPlacement="Shift" plotOffset="12" valueType="DateTime" interval="@Model.DateTimeAxisIntervalGrouping" intervalType="@Model.DateTimeAxisInterval" labelFormat="@Model.DateTimeAxisDateFormat" minimum="@Model.DateFrom" maximum="@Model.DateTo">
    <e-majorgridlines width="0"></e-majorgridlines>
        <e-primaryxaxis-stripline visible="true" text="Stripline" color="red"></e-primaryxaxis-stripline>

What are we doing that is causing rhe control to think we are using a PivotViewStripLine?

Srihari Muthukaruppan [Syncfusion]
Replied On February 12, 2021 05:03 AM UTC

Hi Pat, 
We have analyzed your query. From that, we would like to let you know that as of now it is not possible to achieve striplines through striplines tag. Hence we suggest you to use below solution in which we have added stripline in code behind to achieve your requirement. We have prepared a sample for your reference. Please find the sample and screenshot below. 
Let us know if you have any concerns. 
Srihari M 


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

Live Chat Icon For mobile
Live Chat Icon