TeeChart笔记(一)

一、绘制Y轴的MarkLine

ColorLine使用

实例化

// 实例化 
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;

效果展示

二、指定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; 
}
 }

效果展示

三、刻度线以及次刻度线设置

 
//设置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;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值