Jump to content
Software FX Community

Colouring Pie Chart "Series"


Smartie

Recommended Posts

Hey,

I'm having trouble setting the colours of "series" on a pie chart.

I currently have a bar chart which I simply loop through the series, if a series name matches a certain value I set the series colour manually.

I would like to do the same when the users chooses to output the chart as pie instead of bar. 

It still runs that code, and sets the series colours but it has no effect on the output of the chart as the pie chart "series" are not the same.

So I though I would try looping through the points on my chart, assuming they were the new "series" but it says I have no points. Chart.Point.Count is 0.

Please advise me how to loop through and change the colour of the "series" on a pie chart.

Thank you.

Link to comment
Share on other sites

Onse series corresponds to a whole pie. Since each Pie slice is colored independently, the series color is not what will affect it.

To change the color of a pie slice you can set:

chart.Points[pointIndex].Color = myColor;

if you want to share the same color for the ith slice of every series, or

chart.Points[seriesIndex,pointIndex].Color = myColor;

if you don't.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...