如何更改图表标签的前景色?

Dev*_*rer 6 c# charts label winforms

如何更改图表标签的前景色?这是图表的屏幕截图 在此输入图像描述

我尝试使用chart1.series[0].FontForeColor = color.white; 但整个图表变成白色。

pKa*_*ami 6

尝试这个:

        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;
Run Code Online (Sandbox Code Playgroud)

这里LabelStyle.ForeColor根据您的要求更改标签颜色。

属性LineColorMajorGrid.LineColor允许修改网格线(屏幕截图上的黑色),以防您也需要。当然,红色和爱丽丝蓝色只是示例。