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
close icon

Horizontal ChartThinStripLine

Hi, I am trying to create a thin ChartStripLine(Basically trying to place a horizontal line of equal width to those in my line chart). Right now I set my values as follows: MeanStrip.Enabled = true; MeanStrip.Vertical = false; MeanStrip.StartAtAxisPosition = true; MeanStrip.Offset = 0.02; MeanStrip.Width = 0.005; MeanStrip.Period = 10000; MeanStrip.Text = ""; MeanStrip.Font = new Font(MeanStrip.Font.FontFamily.Name, 18); MeanStrip.TextColor = Color.CadetBlue; MeanStrip.Interior = new BrushInfo(100, new BrushInfo(GradientStyle.Vertical, Color.Red, Color.Red)); chartcontrol.PrimaryYAxis.StripLines.Add(MeanStrip); I output my chartcontrol as an image, which should not be a problem. I believe the problem is because my axis values are generated dynamically and can range from anywhere from -200 to 1000. Because of this, when I generate my chart I use the "chartcontrol.RangeType = ChartAxisRangeType.Auto", and the first problem is that the ChartStripLine.Width is based on the internal chart values, not the number of pixels like a series line. The second problem is based with the offset. I can have negative values, so sometimes the YAxis shows negative values too. The ChartStripLine.Offset begins at the lowest YAxis value and NOT zero. So for this situation, I think I will either need to be able to set it to start off zero, or to figure out how to get the lowest value on the YAxis when ChartAxisRangeType is Auto. Thanks for your help. Musters

2 Replies

AD Administrator Syncfusion Team October 4, 2005 07:59 PM UTC

This thread may be of interest to you: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=34133 It includes a sample that creates a vertical line on a position on the x-axis. Should be easily modifed to a horizontal line. Min and max values you find in the Range object, and are set after the autorange is applied (after adding series i think): PrimaryYAxis.Range.Min PrimaryYAxis.Range.Max Rune >Hi, I am trying to create a thin ChartStripLine(Basically trying to place a horizontal line of equal width to those in my line chart). > >Right now I set my values as follows: > >MeanStrip.Enabled = true; >MeanStrip.Vertical = false; >MeanStrip.StartAtAxisPosition = true; >MeanStrip.Offset = 0.02; >MeanStrip.Width = 0.005; >MeanStrip.Period = 10000; >MeanStrip.Text = ""; >MeanStrip.Font = new Font(MeanStrip.Font.FontFamily.Name, 18); >MeanStrip.TextColor = Color.CadetBlue; >MeanStrip.Interior = new BrushInfo(100, new BrushInfo(GradientStyle.Vertical, Color.Red, Color.Red)); >chartcontrol.PrimaryYAxis.StripLines.Add(MeanStrip); > >I output my chartcontrol as an image, which should not be a problem. I believe the problem is because my axis values are generated dynamically and can range from anywhere from -200 to 1000. Because of this, when I generate my chart I use the "chartcontrol.RangeType = ChartAxisRangeType.Auto", and the first problem is that the ChartStripLine.Width is based on the internal chart values, not the number of pixels like a series line. The second problem is based with the offset. I can have negative values, so sometimes the YAxis shows negative values too. The ChartStripLine.Offset begins at the lowest YAxis value and NOT zero. So for this situation, I think I will either need to be able to set it to start off zero, or to figure out how to get the lowest value on the YAxis when ChartAxisRangeType is Auto. > >Thanks for your help. >Musters


GM Geetha M Syncfusion Team October 5, 2005 02:19 PM UTC

Hi Musters, We regret for the delayed response. Please refer the attached sample. In the sample ChartAreaPaintEvent Handler is used to draw the stripline with Pen object so that the width is maintained in pixels. F35537_792.zip I hope this helps you. Please let me know if you have any questions. Regards, Geetha.

Loader.
Live Chat Icon For mobile
Up arrow icon