We are using the 2011 CRM out of the box Pie charts. Our Pie Charts will show 4 sections and each section should be shown in a particular color.
Like section1 in Yellow
Section2 in Green
Section3 in Orange
Section4 in Red.
We have put these colors into the custom pallete colors of the CRM Chart's xml.
Now our problem is when there is no data for section1; section2 is showing as yellow, Section3 is Green and Section4 is Orange
when there is no data for section1 and section2; section3 is showing as yellow, Section4 is Green
when there is no data for section1 section2 and section3; section4 is showing as yellow.
How to rectify this problem. Can we rectify this problem in 2011 CRM Charts.
I don't think that this is going to be possible to control.
The CRM SDK confirms that charts use Microsoft Chart Controls and that specifically, of the two pieces of XML that describe your chart, it is the "presentation description XML" that influences the way your chart looks.
The SDK goes on to say that:
the XML is a serialization of the Chart class in Microsoft Chart Controls
The Chart class has a property for the Palette in use by a chart, which in CRM is specified in the Chart
node (see Sample Charts). In any case, the usage of this palette by the Chart class for Pie charts is thus:
First available colors used from Chart control palette. One color per data point.
Note "first available colors" [sic]. The Chart control SDK notes do not include any information on overriding this behaviour. Even if they did, you would then need to translate this (somehow) from .Net managed code properties and assignments into CRM's XML serialization of the same objects.
Final thought - you could try playing about with the Points
collection perhaps to force each datapoint to adopt a particular colour. I'm thinking something like this in your presentation XML but this really is guesswork on my part:
<Chart Palette="None" PaletteCustomColors="97,142,206; 209,98,96; 168,203,104; 142,116,178; 93,186,215; 255,155,83; 148,172,215; 217,148,147; 189,213,151; 173,158,196; 145,201,221; 255,180,138">
<Series>
<Series ShadowOffset="0" IsValueShownAsLabel="true" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">
<SmartLabelStyle Enabled="True" />
<Points>
<DataPoint Color="97,142,206"/>
<DataPoint Color="209,98,96"/>
<DataPoint Color="168,203,104"/>
<DataPoint Color="142,116,178"/>
</Points>
</Series>
</Series>