How to add a custom chart palette in Cognos Charts

If you are working with cognos charts and developed a few of them you might have got vexed with the same color coding all the time and you might have looked in around for some changes in graphics options or you might have wondered how to create a custom chart palette in cognos report studio?

Why do we require a cutom chart paletter?
In cognos, by default we get a palette of colors which are same for all the reports and if you would like to customize, you should follow some specific options as mentioned below.
Default chart color palette before customizations look like this.



Steps to Customize a Cognos Charts palette:
1. Inside Cognos Directory, an xml named Chart palettes is found which is responsible for the cognos Chart palette colors. Now, we are going to edit this xml inorder to show up the colors that we want. The default location of this is C:\Program-Files\Cognos\c8\ webcontent\pat\res\ChartPalettes.xml

2. Now you can select your colors using any of the color palettes available out there. Here is a sample color paletter available for your quick usafe or you can go online an browse for color palettes.

3. After choosing what colors you are going to pick for, don't forget to take a backup of already installed ones because we are going to create a new one and not messup with an old one.

4. In the chart palette XML in the tag "", you have to give values for 5 fields namely id, label, idsLabel, tooltip, idsTooltip which are seen when selecting from a cognos backend. IDSLABEL and IDSTOOLTIP are for the corresponing LABEL and ToolTip. These are Unique nubers which represent the strings in Label an Tooltip.

So after giving the values a typical tag looks like below and After giving the corresponding values in the above tag, we go adding the colors like below.

<namedChartPalette id=”Uniq_Sample_Id” smallIcon=”Location of you icon.gif file” idsLabel=”ID_Uni_Label1” idsTooltip=”ID_Unique_Tooltip1”>
<chartPalette>
<chartColor value=”#A25C4F”/>
<chartColor value=”#B3D699″/>
<chartColor value=”#C4B964″/>
<chartColor value=”#D56481″/>
<chartColor value=”#E6635A”/>
<chartColor value=”#F72263″/>
<chartColor value=”#E84A5C”/>
<chartColor value=”#D98425″/>
<chartColor value=”#C0C1D5″/>
<chartColor value=”#B1BEF”/>
</chartPalette>
</namedChartPalette>


5. Now after Editing the color palette save the xml file and check for the reportstudio_en.xml which is for reportstudio english version. We will add the name here in order to show our create palette in the report studio to select an use.

6. In this file, search for “IDS_PAL_NAME_default” and add the two names of IDsTooltip and IDsLabelName here so the code should look like

7. Now you can save an icon with the name you gave in above and in the gif format. It should be in 48x16 size. It can be done using any photo editing software like photoshop, gimp or paint and dont forget it to put in the folder given by you in the above tag.

<string id=”ID_Uni_Label1” type=”Control Label”>Sample Chart palettes</string>
<string id=”ID_Unique_Tooltip1” type=”Control Label”>This is simply for test paletter</string>


8.Now restart your cognos and open the report studio and go to the palette drop down menu. You will now see the recently created palette name to select from the list.  After applying to our pie chart as seen above the chart looks like this now.




So, now you have got a palette of your choice. You can repeat the above steps any number of times.


~Urs Krish

1 comments:

Anonymous said...

How does this work in Cognos 10.2?

Post a Comment