Jump to content
Software FX Community

Custom pie slice colors with multiple charts


Recommended Posts

I have attempted to replicate your pie chart demo.

When I specify a custom color for a pie chart that has multiple series like so:

chart1.Points[0, 0].Fill = Brushes.Chartreuse;

chart1.Points[1, 0].Fill = Brushes.Chartreuse;

chart1.Points[2, 0].Fill = Brushes.Chartreuse;

chart1.Points[3, 0].Fill = Brushes.Chartreuse;

The "highlight" effect does not work properly.

Here is the desired behavior, as shown on one of the slices using a default color:

Posted Image 

You will see that the orange slice (with the default color) is highlighted across all charts.

When I hover over the pie slice that I have set a custom color for:

Posted Image 

Only the legend is highlighted, and not the pie slices on the additional charts.

I have made sure that each chart has its pie slice color at index 0 set to the same color (Brushes.Chartreuse).

Is there any way to get the pie slices to highlight when I'm using a custom color?

Thank you,


Link to comment
Share on other sites

If you are using the same brush for all the series with a specific point then you want your code to look like this

  chart1.Points[0].Fill = Brushes.Aqua;

  chart1.Points[1].Fill = Brushes.Brown;

By using the indexer with only 1 parameter (point) you are telling that us that the attributes are shared by all series.


When you use per-point attributes highlight will work with all the elements that are using the same "PointAttributes", e.g. if you do this

PointAttributes p = new PointAttributes();

p.Fill = Brushes.Red;

chart1.Points[0,2] = p:

chart1.Points[1,5] = p;

And hover over the third point on the first series (0,2) we will also highlight (1,5). But when you use the getter

chart1.Points[0,2].Fill = Brushes.Red

We are creating a brand new point attribute that will not be shared.


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.

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...