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


Thread ID:





34133 Sep 2,2005 01:55 PM UTC Sep 8,2005 06:15 AM UTC WinForms 4
Tags: Chart
Rune Selvaag
Asked On September 2, 2005 01:55 PM UTC

Hi, I want to add vertical lines at positions on the x-axis. I have tried the ChartStripLine and it does almost what I want. The problem I''m having is that the ChartStripLine works for a range, and has a width. This means that when resizing or zooming, the width of the line you see changes. A series with a line does not do this (or the grid lines in the chart), and i want the strip line to behave like a line series. In other words, the vertical line should have the same width regardless of chart size and zoom. Is there a way to achieve this? Regards Rune

Geetha M [Syncfusion]
Replied On September 5, 2005 01:52 PM UTC

Hi Rune, Sorry for the delayed response. Please refer the sample attached below. ChartStripLines_1665.zip You can use the ChartAreaPaint event handler to draw and to maintain the width of the stripline as constant while Zooming. Please let me know if this helps. Thanks for your interest in Syncfusion products. Regards, Geetha.

Rune Selvaag
Replied On September 6, 2005 07:11 AM UTC

Hi Geetha, Thank you for the reply and the sample. This is not quite what i was looking for. I need the line to stay fixed to a position on the axis. When you resize in the sample, the line changes position relativ to the axis. I also asked for a vertical line on the x-axis. I need it to behave like a strip line, but with constant width. Regards Rune

Administrator [Syncfusion]
Replied On September 6, 2005 01:55 PM UTC

Hi Rune, Please refer to the sample linked to below. This sample uses the ChartAreaPaint event and calculates the coordinates based on where you want the vertical line to appear. ChartStatLines_6068.zip Thanks, Davis

Rune Selvaag
Replied On September 8, 2005 06:15 AM UTC

Thanks Davis, I adjusted the sample so that the line was clipped, and only visible inside the axes (chart area). In your sample the line is also shown outside the chart area when zooming. I uses VisibleRange to achieve this: double xPos = 100; if ((xPos >= chart.PrimaryXAxis.VisibleRange.Min) && (xPos <= chart.PrimaryXAxis.VisibleRange.Max)) { ChartPoint pt1 = new ChartPoint(xPos, chart.PrimaryYAxis.VisibleRange.Min); ChartPoint pt2 = new ChartPoint(xPos, chart.PrimaryYAxis.VisibleRange.Max); Point lineStart = chart.ChartArea.GetPointByValue(pt1); PointF lineEnd = chart.ChartArea.GetPointByValue(pt2); e.Graphics.DrawLine(new Pen(Color.Red),lineStart, lineEnd); } Again, thank you for great support. Rune


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

or the page will be automatically redirected to 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