2
votes

I am using Crystal Reports 2008 (12.4.0.966), and can't seem to force specific colors in a pie chart.

We are analyzing selected measurement topic (MT) scores of elementary and middle school students. The report has five groups, and the chart is going into the Group 3C Footer (where a parameter can cause it to be suppressed if desired). I have a database column Score that can have values from 0.000 to 4.000. To enjoy some sanity for the resulting charts I impose granularity with the @LetterGrade formula:

SELECT {Reporting_CFSD_MT_Scores_A;1.Score}
    CASE IS >= 3.5 : "ADV"  // Advanced
    CASE IS >= 3.1 : "PRO+" // Proficient Plus
    CASE IS >= 3.0 : "PRO"  // Proficient
    CASE IS >= 2.5 : "APP"  // Approaching Proficiency
    CASE IS >= 2.0 : "BASI" // Basic
    DEFAULT : "BLB"         // Below Basic

In the Chart Expert >> Data tab, I've got On Change Of @LetterGrade with specified order based on the order in the formula above, and my Show Value is Count of @LetterGrade. The resulting pie chart gives me the break down of grades that I need.

The problem is that I want each of the six pie slices to have a specific color -- from bottom to top: Red, Orange, Yellow, Green, Blue, (Dark) Violet -- rather than accept the default colors. I thought I could go to the Color Highlight tab in the Chart Expert and have six entries (e.g., @LetterGrade = "ADV" sets a custom color of dark violet (and I've tried it with and without the quotes around the string)), but the first pie slice is always blue, the second is always tan, the third is always green, etc., regardless of what value it represents.

Am I misunderstanding the purpose of the Color Highlight tab? Is it not possible to set custom pie slice colors in this version of Crystal Reports (after more hoops than I care to think about I'm finally downloading SP5, but at the rate its coming in I may not have it fully downloaded until tomorrow; God help me if the solution is in one of the six 5.X or 6.X Fix Packs)? Or am I just missing a trick somewhere?

EDIT: For giggles I changed the sort order on the Data tab from a specified order to ascending order and now the pie slices are exactly the colors I wanted. So it appears that I can either specify the display order of the slices and have to accept the default colors, or I can let it display in an undesirable order and get the colors I want. Sounds like a bug to me, unless someone knows a trick for getting around this.

2

2 Answers

0
votes

If I'm not mistaken, in the report editor, preview the report and then click on a pie slice so it is selected. Then right click on that slice and select "Format Pie Sclice". Then you can change the color, pattern, gradient, etc.

Let me know if that works.

Chris

EDIT: If you want to do it conditionally, I think you may need to specify

@LetterGrade => 2.0

which in the editor should be @LetterGrade is greater or equal to 2.0

instead of

@LetterGrade = "BASI"

But you should be getting a choice of values when you create your conditions. I did a quick sample report with a chart that shows me the onhand value of certain items and I was able to "hardcode" the colors using the steps outlined in my original answer and also conditionally by using the Color Highlight wizard and the predefined values.

0
votes

It turns out that editing the chart in design view doesn't work correctly. In the design view, when I use the Chart Expert I can either specify the order in which the slices are displayed, or I can designate the color for individual slices, but I cannot do both (also, in the Highlight Color tab, the last box in the Item Editor section -- where you choose the value to match -- does not give me a drop-down menu from which to choose, but instead will only let me type in the value to match: thank you @campagnolo_1 for bringing this lack to my attention, which pointed me toward the solution).

If I instead work in the preview view, click on the chart, and pull up the Chart Expert there (and choose Applied to group template), I can both set the sort order and the highlight color.

I'm guessing this is a bug, but since CR2008 isn't supported any more, I'll just have to live with it.