how can I change forecolor of a chart label?

c#, charts, label, winforms

Solution

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.

Problem

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.

Original source

Related problems