Need to control the color of the Pie Chart Slices


https://www.nevron.com/Forum/Topic7456.aspx
Print Topic | Close Window

By Dave Blosser - 11 Years Ago

Is there any way to control the color of the Pie Chart fill?  I want to create a multi-chart page showing different sets of the same data.  The values of the Pie series are the count of the rows from the filtered set of a certain status.  To be easily readable the fill needs to be the same on each chart if it represents the same status.  In other words, if the pie slice represents "In-Control" that slice should always be green no matter what charts..  If the pie slice represents "In-Progress" then the slice should always be yellow.  There are only five different statuses in the list.

By Nevron Support - 11 Years Ago

Hello Dave,
You can easily achieve this by using Custom Data Points Appearance and write an expression.
For example, for the Pie chart, let’s say that you have category grouping by “Status”: =Fields!Status
For the Values, in order to count the rows for a certain status, in the Value field you should use: =Fields![RowCount]
In the Labels filed, you can use: =Fields!Status
That way, you can have the Statuses and their count in the chart legend. In the Legend tab >> Format filed use: <label> <value>

To use Custom Data Points Appearance for the pie slices:
From the Pivot tab >> Data Groupings >> Values >> Appearance tab, check “Use Custom Data Points Appearance”.
Then for the Fill and Border style, uncheck Automatic and for the Color field use an expression like this:
=IF(FIRST(Fields!Status) = "In-Control", "Red", IF(FIRST(Fields!Status) = "In-Progress", "Blue", IF(FIRST(Fields!Status) = "Closed", "Gray", IF(FIRST(Fields!Status) = "Opened", "Green", IF(FIRST(Fields!Status) = "Pending", "Yellow", "White")))))

Hopefully this helps.

By Dave Blosser - 11 Years Ago
Works like a charm. I appreciate the no code solution and your quick response.