问题
how can i change the fore color of the chart labels? here's a screenshot of the chart
i tried using the chart1.series[0].FontForeColor = color.white; but the entire chart turns white.
回答1:
Try this:
this.chart1.BackColor = Color.AliceBlue;
this.chart1.ChartAreas[0].AxisX.LineColor = Color.Red;
this.chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Red;
this.chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.Red;
this.chart1.ChartAreas[0].AxisY.LineColor = Color.Red;
this.chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Red;
this.chart1.ChartAreas[0].AxisY.LabelStyle.ForeColor = Color.Red;
Here LabelStyle.ForeColor
changes the label color, as you requested.
The properties LineColor
and MajorGrid.LineColor
allow modification of the grid lines (black on your screenshot), in case you need that as well. The colors Red and AliceBlue, of course, are just for example.
来源:https://stackoverflow.com/questions/21822762/how-can-i-change-forecolor-of-a-chart-label