图表网格线样式 [英] Charts grid lines style
本文介绍了图表网格线样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Visual Studio 2010中的标准图表库。
图表工作正常,但无法更改轴网格线样式。
这些是Form1.Designers.cs
I am using the standard charts library from Visual Studio 2010. The chart works fine but I am unable to change the axis grid line style. These are the properties already set in Form1.Designers.cs
chartArea3.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea3);
legend3.Name = "Legend1";
this.chart1.Legends.Add(legend3);
this.chart1.Location = new System.Drawing.Point(12, 68);
this.chart1.Name = "chart1";
series5.ChartArea = "ChartArea1";
series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series5.Color = System.Drawing.Color.Red;
series5.Legend = "Legend1";
series5.Name = "Temp";
series6.ChartArea = "ChartArea1";
series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series6.Color = System.Drawing.Color.Blue;
series6.Legend = "Legend1";
series6.Name = "Umid";
this.chart1.Series.Add(series5);
this.chart1.Series.Add(series6);
this.chart1.Size = new System.Drawing.Size(647, 182);
this.chart1.TabIndex = 8;
this.chart1.Text = "chart1";
this.chart1.ChartAreas[0].AxisY.Interval=5;
我想使轴网格类型为点或破折号。 I尝试过:
this.chart1.ChartAreas[0].AxisX.LineDashStyle.??????
但是我不知道如何分配属性和/或上面的部分代码行是正确的。
but then I do not know how to assign the property and/or if the above partial line of code is correct.
推荐答案
最后我说对了:
this.chart1.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
this.chart1.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDotDot;
这正在工作,可以访问网格轴的线型。
This is working and gives access to the line style of the grid axes.
this.chart1.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.availableStileSelectionHere;
这篇关于图表网格线样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文