C#在chart波形图上面添加标记标记线或标记区域
源码如下:
private void CreateStripLine(int startPoint, int endPoint)
{
if (endPoint > startPoint)
{
StripLine sl1 = new StripLine();//新建一个插入线
sl1.BackColor = System.Drawing.Color.Silver;
sl1.IntervalOffset = startPoint;//通过IntervalOffset来设置线的位置
sl1.StripWidth = endPoint - startPoint;//设置线的宽度
sl1.Tag = 1;//设置线的标记,用于区分选中的哪个
sl1.BorderColor = Color.DarkGray;
sl1.BorderDashStyle = ChartDashStyle.Dash;
sl1.BorderWidth = 1;
chart1.ChartAreas[0].AxisX.StripLines.Add(sl1);//插入垂直于X轴的StripLine,若垂直于Y轴则用AxisY。
}
}
参考:https://blog.csdn.net/sy95122/article/details/92770952
https://www.it610.com/article/1275221855959007232.htm