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.

ChartStripLine

Thread ID:

Created:

Updated:

Platform:

Replies:

34133 Sep 2,2005 09:55 AM Sep 8,2005 02:15 AM Windows Forms 4
loading
Tags: Chart
Rune Selvaag
Asked On September 2, 2005 09:55 AM

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 09:52 AM

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 03:11 AM

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 09:55 AM

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 02:15 AM

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

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.

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.

;