How can I change forecolor chart labels?

How can I change the color of the front chart labels? here is a screenshot of the chart enter image description here

I tried using chart1.series [0] .FontForeColor = color.white; but the whole graph turns white.

+3
source share
1 answer

Try the following:

        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;

This LabelStyle.ForeColorchanges the color of the label as you requested.

Properties LineColorand MajorGrid.LineColorallow you to change the grid lines (black in the screenshot), if you need it. Of course, the colors Red and AliceBlue are, for example.

+2
source

All Articles