Notas de TeeChart (1)

1. Dibuje la MarkLine del eje Y

Uso de ColorLine

instanciar

// 实例化 
colorLine Steema.TeeChart.Tools.ColorLine colorLine = new Steema.TeeChart.Tools.ColorLine(this.tChart1.Chart); colorLine.Active = true; 
//所在轴 
colorLine.Axis = tChart1.Axes.Left; 
//值设置
 colorLine.Value = Convert.ToDouble((textBox1.Text.Trim()));
 //颜色设置
 colorLine.Pen.Visible = true; colorLine.Pen.Color = cleBg.Color;
 //粗细设置 
colorLine.Pen.Width=2;
 //线条样式设置 实线/虚线等 
colorLine.Pen.Style=System.Drawing.Drawing2D.DashStyle.Solid;

Mostrar resultados

2. Especifique el color de los puntos dentro del valor del intervalo del eje Y

 
 
//自定义第一条线的Y轴值 
double A=20; 
//自定义第二条线的Y轴值 
double B=25; /
/在触发处绑定GetPointerStyle事件 
line.GetPointerStyle += Line_GetPointerStyle; 
private void Line_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e) 
{ 
//因为e.ValueIndex从-1开始 所以做加1处理 
int index = e.ValueIndex + 1; 
//符合条件的改变其颜色,颜色也可前端配置读取 
if (Convert.ToDouble(this.tChart.Series[0][index].Y) >= A && Convert.ToDouble(this.tChart.Series[0][index].Y) <= B) 
{ series.Pointer.Color = System.Drawing.Color.Green; } else { 
//看需求添加 ,符合条件外的改变点的颜色 //如不需改变可去掉整个else部分的代码 eries.Pointer.Color = System.Drawing.Color.Blue; 
}
 }

Mostrar resultados

3. Ajustes de línea de escala y línea de marca secundaria

 
 
//设置Y轴主刻度线 
this.tChart1.Axes.Left.Ticks.Visible = true; 
//刻度线粗细 
this.tChart1.Axes.Left.Ticks.Width = 2; 
//设置Y轴次刻度线 
this.tChart1.Axes.Left.MinorTicks.Visible = true;
 //设置Y轴次刻度线长度
 this.tChart1.Axes.Left.MinorTicks.Length = 5;
 //设置Y轴次刻度线铺满 
this.tChart1.Axes.Left.MinorGrid.Visible = true; 
//铺满条数 
this.tChart1.Axes.Left.MinorTickCount = 2;

Supongo que te gusta

Origin blog.csdn.net/qq_29728817/article/details/128834388
Recomendado
Clasificación