Multiple Pivot Pie Charts - Different Colors

tugadesp

New Member
Joined
Oct 1, 2015
Messages
2
Hi all,

I just joined MrExcel because I was freaking out.

I am generating 4 different Pivot Pie Charts with Data coming from an external Excel File.
It works pretty fine.


Actually the 4 Pies are displaying the same data but each pie has a different filter on it. So I get in Pie 1 all the data where "Severity = Critical"
and in the second one where Severity = High, and so on...


The problem is: The color schemes are automatically changed when there are not the same amount of catagories.
di-A8Q5.png




As you can see: "09 Test Data Issue" has a different color in Pie1 than in Pie 2 (because 07 and 08 don't exist).

Does any one know how to set specific chart categories to a specific color programmatically?


I've tried this when creating the chart, but this doesn't work:
Code:
With .Chart.SeriesCollection(1)
            For i = 1 To .Points.Count
                With .Points(i)
                    PointText = .DataLabel.Text
                    Select Case PointText
                        Case "01 Environment Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(0, 0, 255)
                        Case "02 Deployment Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(218, 165, 32)
                        Case "03 Requirements Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(139, 69, 19)
                        Case "04 Design Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(119, 136, 153)
                        Case "05 Code Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(0, 100, 0)
                        Case "07 Test Design Issue (Detected in ST/AT)"
                            .Format.Fill.ForeColor.RGB = RGB(178, 34, 34)
                        Case "08 Test Execution Issue (Detected in ST/AT)"
                            .Format.Fill.ForeColor.RGB = RGB(147, 112, 219)
                        Case "09 Test Data Issue (Detected in ST)"
                            .Format.Fill.ForeColor.RGB = RGB(0, 191, 255)
                    More Cases
                    End Select
                    .HasDataLabel = False
                End With
            Next i
        End With






Thanks in advance.




Tuga
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top