Visual chart

I may be asking the wrong question, but I need to add a Guideline to my window shape diagram. In other words, I have a chart with simple data series, and I need to draw a line along the y axis while passing the count, or 80%. I do not want to add a second series, since the first series has an indefinite number of data points. Is there an easy way to just draw one line along the y axis? The dotted line below is what I am shooting (she does not need arrows).

100| | 90| | o 80|<-----------------------> | 70| oo | 60| o | oo 50|oo |_________________________ 1 2 3 4 5 6 7 8 9 
+6
source share
4 answers

Try to add StripLine
For instance:

 var series = chart1.Series[0]; //series object var chartArea = chart1.ChartAreas[series.ChartArea]; chartArea.AxisY.StripLines.Add(new StripLine { BorderDashStyle = ChartDashStyle.Dash, BorderColor = Color.DarkBlue, Interval = 10//Here is your y value }); 
+3
source

Apologies for repeating Don Kirkby's answer, but I have no answer to add a comment.

Using HorizontalLineAnnotation , you can set ClipToChartArea , which will limit the length of the line inside the chart to solve the problem you specified.

 ChartArea area = ...; var line = new HorizontalLineAnnotation(); line.IsInfinitive = true; // make the line infinite line.ClipToChartArea = area.Name; line.LineDashStyle = ChartDashStyle.Dash; 

Assuming your y axis has values ​​on a scale from 0..1, you can attach the line to the Y axis with line.AxisY = area.AxisY , which causes its position to be interpreted as the axis value, and then set line.Y = 0.8; for attaching in position 80%.

+8
source

I never used charts, but HorizontalLineAnnotation sounds promising.

+2
source

You can add points to a frame with a cycle that, for example, has a cycle of 900 for values ​​from 1 to 9. For each cycle, the compiler will calculate the value and leave a point for this perimeter, and another for the next one, so that it looks like an equation line :)

0
source

Source: https://habr.com/ru/post/897763/


All Articles