Deviruchi D Devourer
Deviruchi D Devourer

Reputation: 341

how can I change forecolor of a chart label?

how can i change the fore color of the chart labels? here's a screenshot of the chart enter image description here

i tried using the chart1.series[0].FontForeColor = color.white; but the entire chart turns white.

Upvotes: 6

Views: 10682

Answers (1)

pKami
pKami

Reputation: 354

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.

Upvotes: 6

Related Questions