John
John

Reputation: 1338

how do you change the text color in a vb.net chart?

I have a chart set up like this:

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)

This works fine, but the default color for the x values that show up on top of the colors in the pie chart is black. I need to set the colors for each individual piece of the pie chart since black is too dark for some pieces and white is too light for others.

How do I change the color of the text that represents the values of the pie pieces?

Thanks. This is a sample of my chart.

Upvotes: 2

Views: 3260

Answers (1)

LarsTech
LarsTech

Reputation: 81675

Try using the LabelForeColor property:

chart1.Series("Chart_1").Points(0).LabelForeColor = Color.Yellow

Upvotes: 5

Related Questions