While Cognos does many things well, most people have different tastes in colors. This article will walk you through creating and installing a custom chart palette. This example is for general charts, but the principles can be applied to maps and gauges in the same XML files.
Example Charts ‘Before’ and ‘After’
1. Choose your colors.
These colors are from the ‘Barn’ palette and others I found at Colour Lovers
They have great palettes to get you started.
2. Edit ChartPalettes.xml
In windows this file is found in:
C:\Program Files\Cognos\c8\webcontent\pat\res
3. You can either create a new palette or just edit the pre-installed ones to suit your color preferences.
In the XML document, explanation of <namedChartPalette> tag properties:
id unique identifier
label the label of the palette which will show up in Report Studio when you choose a palette.
idsLabel string resource id for the label, as defined in reportstudio_xx.xml files.
tooltip the tooltip
idsTooltip string resource id for the tooltip, as defined in reportstudio_xx.xml files.
The idsLabel and idsTooltip you assign here will be used later in to create the actual text label.
4. The complete palette section will look like this:
<namedChartPalette id=”normalMyCompany” smallIcon=”chart/palette/normal/mycompanypalette.gif” idsLabel=”IDS_PAL_NAME_MyCompany” idsTooltip=”IDS_PAL_TOOLTIP_MyCompany”>
<chartPalette>
<chartColor value=”#C25C4F”/>
<chartColor value=”#E9D699″/>
<chartColor value=”#B9B964″/>
<chartColor value=”#826481″/>
<chartColor value=”#70635A”/>
<chartColor value=”#EF2263″/>
<chartColor value=”#D54A5C”/>
<chartColor value=”#828425″/>
<chartColor value=”#A2C1D5″/>
<chartColor value=”#BFEBEF”/>
</chartPalette>
</namedChartPalette>
5. Add a text name for the palette.
Edit reportstudio_en.xml in same directory.
The ‘_en’ designates the English file. Repeat as needed for other language files.
6. Search and find the section of name tags by seaching for “IDS_PAL_NAME_default”
Below that, add 2 new tags:
<string id=”IDS_PAL_NAME_MyCompany” type=”Control Label”>My Company palette</string>
<string id=”IDS_PAL_TOOLTIP_MyCompany” type=”Control Label”>My Company Barn palette.</string>
7. Create a custom palette icon for Report Studio and save as a GIF image.
Images are 48 x 16 pixels with a sample of each color.
I used one of the ones that Cognos installed and filled it in with my colors in a photo editing software.
Name the GIF exactly as specified in the opening tag for your palette the ChartPalettes.xml
In this example we used smallIcon=”chart/palette/normal/mycompanypalette.gif”
8. Save or upload the image to your server.
In Windows servers save it to:
C:\Program Files\Cognos\c8\webcontent\pat\images\chart\palette\normal
Here is what the menu will show once we finish.
9. Restart your Cognos service.
If you just changed color codes in the preinstalled ‘normalDefault’ palette, now all your charts.
If you followed all the steps and added a new palette as above, it will now be available in Report Studio.
To test it, open Report Studio, create a new chart and look in the properties for ‘Palette: …’
Click the elipses to to see the palette menu.
In the drop down you should now see ‘My Company palette’ as one of the options with your image preview.