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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart background for certain regions

Thread ID:

Created:

Updated:

Platform:

Replies:

119360 Jun 10,2015 06:48 PM UTC Jun 12,2015 07:08 AM UTC WPF 3
loading
Tags: Chart
James
Asked On June 10, 2015 06:48 PM UTC

Hello,

I have an XY-style line chart. My X axis is the year (range: 2010 - 2030) and I want to add a visual distinction on the chart between the past and the future. I was thinking of doing this in 1 of 2 ways:

1) Have a vertical line on the current date separating past and future.
2) Color the background region of the past (2010 - current date) a light gray.

Does anyone know if both these features can be reliably implemented with the Chart control?

Regards,
James

Suresh S [Syncfusion]
Replied On June 11, 2015 01:04 PM UTC

Hi James,

Thanks for contacting Syncfusion support.

We have analyzed your query and achieved your requirement using Chart Striplines and Annotations. For more information regarding stripline, annotations please refer our help documentation link. Also, we have prepared a sample based on this, please download from below location,

Ug link1: http://help.syncfusion.com/ug/wpf/Documents/annotations.htm

Ug link2: http://help.syncfusion.com/ug/wpf/Documents/striplines.htm

Please let us know in case of any query.

Regards,

Suresh S


Attachment: chartcontrol_c01b178c.zip

James
Replied On June 11, 2015 04:58 PM UTC

Thanks for your response Suresh.

This looks like it will achieve what I'm looking for. However I'm not using SfChart here but Chart. I tried using this code but it didn't work:

Axis.StripLines.Add(new ChartStripLine() { Stroke = new Pen(Brushes.Black, 2), IsEnabled = true, Start = StripLineStart, Width = StripLineWidth, Interior = Brushes.LightGray });

I took a look at the sample you attached and noticed that the gridLines and minorGridLines under the Strip line are not visible. Can something be done about that? If not then I'll just settle for using the Annotation but I don't think that is supported in the Chart object (only the SfChart). Please correct me if I'm wrong there.

Thanks again.

James

Suresh S [Syncfusion]
Replied On June 12, 2015 07:08 AM UTC

Hi James,

Thanks for update.

We have analyzed your query and classic chart control supports both Annotations, Striplines and axis gridlines will be visible by default when striplines is placed. For more information regarding this refer our below help documentation link. We have modified the below sample based on this, please download from below location,

Ug link1: http://help.syncfusion.com/ug/wpf/Documents/chartstriplines.htm

Ug link2: http://help.syncfusion.com/ug/wpf/Documents/annotations2.htm

Sample: chart

Please let us know in case of any query.

Regards,

Suresh S


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.

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

;