C#chart控件初始化

C#chart控件初始化

C#中调用chart控件以时间为横轴进行初始化的一些知识

// An highlighted block
this.chart1.ChartAreas.Clear();
ChartArea chartArea1 = new ChartArea("C1");
this.chart1.ChartAreas.Add(chartArea1);
this.chart1.Series.Clear();
Series series1 = new Series("S1");
series1.ChartArea = "C1";
this.chart1.Series.Add(series1);
his.chart1.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss";          //显示当前时间
this.chart1.ChartAreas[0].AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Seconds;
this.chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;
this.chart1.ChartAreas[0].AxisX.MajorGrid.Interval = 1;                 //网格间隔
this.chart1.ChartAreas[0].AxisX.Minimum = DateTime.Now.ToOADate();      //当前时间
this.chart1.ChartAreas[0].AxisX.Maximum = DateTime.Now.ToOADate();
this.chart1.Series[0].Color = Color.Red;                               //设置颜色
this.chart1.Series[0].ChartType = SeriesChartType.Line;
this.chart1.Series[0].Points.Clear();                
上一篇:winform 绘图控件 chart 实时曲线图


下一篇:QT图表chart-饼状图