我的图表设置如下:
Dim chart1 as new chart()
Dim yValues As Double() = {a1, a2, a3, a4}
Dim xValues As String() = {level1, level2, level3, level4}
chart1.Series.Add("Chart_1")
chart1.Series("Chart_1").ChartType = SeriesChartType.Pie
chart1.Series("Chart_1").Points.DataBindXY(xValues, yValues)
chart1.Series("Chart_1").Points(0).Color = Color.FromArgb(255, 0, 158, 43)
chart1.Series("Chart_1").Points(1).Color = Color.FromArgb(255, 255, 185, 59)
chart1.Series("Chart_1").Points(2).Color = Color.FromArgb(255, 171, 0, 0)
chart1.Series("Chart_1").Points(3).Color = Color.FromArgb(255, 175, 175, 175)
这样可以正常工作,但饼图中颜色顶部显示的x值的默认颜色为黑色。我需要为饼图的每个单独的部分设置颜色,因为对于某些部分,黑色太暗,而对于其他部分,白色太亮。
如何更改代表饼图值的文本颜色?
感谢。
答案 0 :(得分:5)
尝试使用LabelForeColor属性:
chart1.Series("Chart_1").Points(0).LabelForeColor = Color.Yellow