MS Chart画线

现在还没搞清楚为什么画不上去,或者画上去的都成了块状的,但是之前由于测试这个代码写了一段是可以画的,所以COPY过来对比了一下,除了Text属性和IntervalOffset属性的先后不同,没有其它的不同,但是结果就是一个画出来是条,另一个是正常的虚线。

这个应该是MS的漏洞,不管是不是,反正我现在就这么认为了。


今天的代码,可以正常的虚线
CrtView.ChartAreas[0].AxisY.MajorGrid.Enabled = false; // 关闭网格线

               StripLine sprUsl = new StripLine();

                sprUsl.Text = "USL";

                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["usl"]);

               //sprUsl.IntervalOffset = 0.43000000000;

                sprUsl.BorderColor = Color.Red;

                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

                sprUsl.BorderWidth = 1;

                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);

 

                sprUsl = new StripLine();               

                sprUsl.Text = "UCL";

                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["ucl"]);

                sprUsl.BorderColor = Color.Red;

                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

                sprUsl.BorderWidth = 1;

                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);

 

                sprUsl = new StripLine();

                sprUsl.Text = "LCL";

                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["lcl"]);

                sprUsl.BorderColor = Color.Red;

                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

                sprUsl.BorderWidth = 1;

 

 

                sprUsl = new StripLine();

                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["tg"]);

                sprUsl.Text = "CL";

                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);//这里应该ADD上去

 

                sprUsl = new StripLine();

                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["lsl"]);

                sprUsl.Text = "LSL";

                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);

昨天的代码:

真尼马奇怪设置了宽度为1也是满格的条状,

StripLine  sprUsl = new StripLine();
                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["usl"]);
                sprUsl.Text = "USL";
                sprUsl.BorderDashStyle = ChartDashStyle.Dash;
                sprUsl.BorderWidth = 1;
                sprUsl.StripWidth = 1;
                sprUsl.BackColor = Color.Red;
                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);

                sprUsl = new StripLine();
                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["ucl"]);
                sprUsl.Text = "UCL";
                sprUsl.BorderDashStyle = ChartDashStyle.Dash;
                CrtView.ChartAreas[0].AxisY.StripLines.Add(sprUsl);

                sprUsl = new StripLine();
                sprUsl.IntervalOffset = Convert.ToDouble(dtChartInfo.Rows[0]["lcl"]);
                sprUsl.Text = "LCL";
                sprUsl.BorderDashStyle = ChartDashStyle.Dash;

             

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值