C# Chart控件

// 定义图表区域
this.chart1.ChartAreas.Clear();
ChartArea chartArea1 = new ChartArea("C1");
this.chart1.ChartAreas.Add(chartArea1);


//定义存储和显示点的容器
this.chart1.Series.Clear();
Series series1 = new Series("OK");
//series1.ChartArea = "C1";
series1.IsValueShownAsLabel = true;
this.chart1.Series.Add(series1);

Series series2 = new Series("NG");
//series2.ChartArea = "C1";            
series2.IsValueShownAsLabel = true;
this.chart1.Series.Add(series2);


//设置图表显示样式
this.chart1.ChartAreas[0].AxisY.Minimum = 0; //设置Y轴最小值
this.chart1.ChartAreas[0].AxisY.Maximum = 100;//设置Y轴最大值 this.chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = 10;//设置Y轴刻度间隔

this.chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = true;//X轴上网格可见
this.chart1.ChartAreas[0].AxisX.IsMarginVisible = false;//不显示X轴的边缘:


this.chart1.ChartAreas[0].AxisX.Interval = 1;
this.chart1.ChartAreas[0].AxisX.LabelStyle.Angle = -45;
this.chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.Silver;
this.chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver;

this.chart1.Series[0].Points.AddXY(0, 88);//添加横坐标为0,纵坐标为88的点

this.chart1.Series[0].BorderWidth = 2;//线条粗细
this.chart1.Series[0].Color = Color.Lime;
this.chart1.Series[1].Color = Color.OrangeRed;

//设置统计饼图样式
this.chart2.Series[0].IsValueShownAsLabel = true;

this.chart2.Series[0].ChartType = SeriesChartType.Pie;

//修改名称

this.chart1.Titles[0].Text = "名称1";

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值