Contents


IBM Cognos Proven Practices

Create Custom Palettes in IBM Cognos 10 Report Studio

Nature of Document: Tip or Technique; Product(s): IBM Cognos 10 Business Intelligence; Area of Interest: Reporting

Comments

Content series:

This content is part # of # in the series: IBM Cognos Proven Practices

Stay tuned for additional content in this series.

This content is part of the series:IBM Cognos Proven Practices

Stay tuned for additional content in this series.

Purpose

This document describes how to add custom palettes into the Report Studio palette dialog.

Applicability

This information applies to Report Studio in IBM Cognos Business Intelligence version 10.1.

Assumptions

This document assumes knowledge of and experience with IBM Cognos Report Studio and palette configuration.

Chart Palette Overview

The IBM Cognos 10 palette needs to account for both the IBM Cognos 8 charts and the IBM Cognos 10 charts. The IBM Cognos 8 chart palette was very simple and did not account for specialization in the charts, while the IBM Cognos 10 chart palette manages specialization. Specialization in this context means that various charts have palette configurations that are unique to them.

In the next two sections we will briefly review the IBM Cognos 8 palette and look at the IBM Cognos 10 palettes in detail. In subsequent sections, we will look at how to add custom palettes to the Report Studio interface.

IBM Cognos 8 Chart Palette Review

The IBM Cognos 8 chart palette consisted of a simple list of solid or gradient colors to be applied to any chart without regard to chart specialization. Custom chart palettes were defined in the ChartPalettes.xml file located in the <IBM Cognos install location>\webcontent\pat\res directory.

XML example in the ChartPalettes.xml file looks like:

<chartPalette>
	<chartGradient direction="down" fromColor="#8599D3" toColor="#5876AE" /> 
	<chartGradient direction="down" fromColor="#E3AE6C" toColor="#CD854E" /> 
	.... More solid colors or gradient can go here
</chartPalette>

Both IBM Cognos 8 and IBM Cognos 10 custom chart palettes are now defined in the ReportPresets.xml file also located in the <IBM Cognos install location>\webcontent\pat\res directory. The IBM Cognos 8 palette is defined here as well so that the palette can be applied to legacy charts from the new Chart Palette Presets toolbar button in the Report Studio UI. For all other IBM Cognos 8 palette customization, refer to the document called Create Custom Chart Palettes for IBM Cognos 8 Report Studio.

In order to leverage your existing IBM Cognos 8 custom chart palettes from the toolbar, you will have to move them into the ReportPresets.xml file.

IBM Cognos 10 Chart Palettes

To author with IBM Cognos 10 charts, ensure the Use legacy chart authoring option is not selected on the Advanced tab in the Report Studio Options dialog found under the Tools menu.

IBM Cognos 10 chart palettes are specialized to the needs of the various chart types allowing much finer control over the chart styling.

There are 4 palette types to account for the needs of the different chart types as so:

Solid: Bar, column, pie, gauge, pie and pareto charts
Line: Line
Point: Scatter and bubble
Progressive: Progressive

These different palettes allow for specialization. For example, the palette for a Progressive chart is highly specialized as seen in Illustration 1 where you can configure Positive and Negative value fills as well as First value and Total value fills.

Illustration 1: Progressive palette illustrating unique fill configurations
Illustration 1: Progressive palette illustrating unique fill configurations
Illustration 1: Progressive palette illustrating unique fill configurations

This is vastly different from a solid palette such as seen in Illustration 2 where you can configure the Fill type, and Colors, Position and Angle if applicable.

Illustration 2: Solid palette showing configurations for a Linear Gradient Fill type
Illustration 2: Solid palette showing configurations for a Linear Gradient Fill type
Illustration 2: Solid palette showing configurations for a Linear Gradient Fill type

Solid Palette

The structure of a solid palette allows you to define how a solid area, such as a pie slice, will be filled. Perhaps it will be filled with a solid color, a gradient color, an image, or a pattern. Illustration 3 shows a pie chart with a gradient fill.

Illustration 3: Pie chart with gradient fill
Illustration 3: Pie chart with gradient fill
Illustration 3: Pie chart with gradient fill

The basic XML syntax for a solid palette in the ReportPresets.xml file looks like:

<v2_solidPalette>
	<v2_solidPaletteEntries>
		<v2_solidPaletteEntry>
			...Define solid color, gradient, image or pattern here as required
		</v2_solidPaletteEntry>
		<v2_solidPaletteEntry>
			...Define solid color, gradient, image or pattern here as required
		</v2_solidPaletteEntry>
			... Define as many palette entries as required
	</v2_solidPaletteEntries>
</v2_solidPalette>

Full details can be found in Chapter 23: Report Specification Reference of the IBM Cognos Software Development Kit Developer Guide. We will look at how to define solid colors, gradients, images and patterns later in this document.

Line Palette

The Line chart structure consists of both a line and markers along that line as shown in Illustration 4.

Illustration 4: Line chart with markers
Illustration 4: Line chart with markers
Illustration 4: Line chart with markers

Therefore, the XML for each Line palette entry, which has an opening tag of <v2_linePaletteEntry>, has both a point definition <v2_pointPaletteEntry>, and a line definition <v2_lineFill>.

The basic XML syntax in the ReportPresets.xml file looks like:

<v2_linePalette>
	<v2_linePaletteEntries>
		<v2_linePaletteEntry>
			<v2_pointPaletteEntry>
				... Define point color, shape, etc here
			</v2_pointPaletteEntry>
			<v2_lineFill>
				... Define line color, pattern, etc here
			</v2_lineFill>
		</v2_linePaletteEntry>
		... Define as many line palettes entries as required.
	</v2_linePaletteEntries>
</v2_linePalette>

Note that definitions, such as point size, that apply to all palette entries are defined in the <v2_linePalette> entry.

Full details can be found in Chapter 23: Report Specification Reference of the IBM Cognos Software Development Kit Developer Guide. We will see how to define points and lines later in this document.

Point Palette

Point palettes describe the color, shape, etc of the point. Points are circles or other shaped objects that plot one or more data series against two measures. Multiple points are plotted for each category on the chart. Illustration 5 shows various circular points on a chart with different colors.

Illustration 5: Point chart with different colored points
Illustration 5: Point chart with different colored points
Illustration 5: Point chart with different colored points

The point palette XML entries, which have the opening tag of <v2_pointPaletteEntry>, share the same syntax as Line palette point entries.

The basic XML syntax in the ReportPresets.xml file looks like:

<v2_pointPalette>
	<v2_pointPaletteEntries>
		<v2_pointPaletteEntry>
				... Define the point color, shape, etc here
		</v2_pointPaletteEntry>
		... Define as many point palette entries as required
	</v2_pointPaletteEntries>
</v2_pointPalette>

Full details can be found in Chapter 23: Report Specification Reference of the IBM Cognos Software Development Kit Developer Guide. We will see how to define points later in this document.

Progressive Palette

This is a highly specialized palette that matches the capabilities of the Progressive chart which allows you to define how Positive, Negative, First, and Total columns are styled using solid colors, gradients, images and patterns. The chart in Illustration 6 shows a Progressive chart using solid colors for each of the various columns.

Illustration 6: Progressive Chart using solid colors for the column fills
Illustration 6: Progressive Chart using solid colors for the column fills
Illustration 6: Progressive Chart using solid colors for the column fills

The basic XML syntax in the ReportPresets.xml file looks like:

<v2_progressivePalette>
	<v2_progressivePositiveValueFill>
		... Define bar styling here
	</v2_progressivePositiveValueFill>
	<v2_progressiveNegativeValueFill>
		... Define bar styling here
	</v2_progressiveNegativeValueFill>
	<v2_progressiveFirstValueFill>
		... Define bar styling here
	</v2_progressiveFirstValueFill>
	<v2_progressiveTotalValueFill>
		... Define bar styling here
	</v2_progressiveTotalValueFill>
</v2_progressivePalette>

Full details can be found in Chapter 23: Report Specification Reference of the IBM Cognos Software Development Kit Developer Guide. We will look at how to define solid colors, gradients, images and patterns later in this document.

IBM Cognos 10 Chart Styling Options

There are many ways a column, slice, line or point can be styled from fills. Let's take a look at some of the most commonly used options.

Fills

Fills are used to define the way in which bars, columns, slices and so on are styled. Fills can also be applied to points and lines as we will see later in this document.

Fills include

  • Solid colors (including optional transparency)
  • Gradients (linear gradients only for lines)
  • Images (not available for lines)
  • Patterns (not available for lines)

Solid Color Fills

A solid fill defines a single color. Sample XML syntax in the ReportPresets.xml file for an entry with transparency set to 25 would appear as:

<v2_fillEffect defaultColor="#447294">
		<v2_solidColor color="#447294" transparency="25"/>
</v2_fillEffect>

While the default color may seem redundant, it is used when the output cannot support the requested fill effect. In this instance, as the fill effect is a solid color, the default color would not normally be used.

Colors may be defined as named colors (like the Report Studio color UI, Named Colors tab) or RBG values (as per the Report Studio color UI, Web safe and custom color tabs).

Transparency can be used for a good effect on Area charts where one area can be seen through another as seen in Illustration 7.

Illustration 7: Area chart showing areas behind a foreground area
Illustration 7: Area chart showing areas behind a foreground area
Illustration 7: Area chart showing areas behind a foreground area

Gradient Fills

While charts support 3 different types of gradients – Linear, Radial Line and Radial Rectangle – we will focus on the most commonly used one, the Linear Gradient, in which you define how many colors are used in the gradient and what angle the gradient appears at.

Let's consider a two color gradient fill. This is the most common type of gradient fill. In the Report Studio user interface, it is configured as shown in Illustration 8 where Linear Gradient is chosen as the Fill type and then colors are selected and the angle is defined as 0 degrees. In this case there are two shades of green, one with a position of 0 and the other with a position of 100.

Illustration 8: Linear Gradient configured for two colors
Illustration 8: Linear Gradient configured for two colors

The result in a chart is shown in Illustration 9 where a darker shade of green on the right fades into a lighter shade of green on the left.

Illustration 9: A column from a Column chart with a gradient consisting of two colors
Illustration 9: A column from a Column chart with a gradient consisting of two colors

The XML definition in the ReportPresets.xml file is:

<v2_fillEffect defaultColor="#89AF47">
	<v2_linearGradient>
		<v2_gradientColor gradientColor="#89AF47"/>
		<v2_gradientColor colorPosition="100" gradientColor="lime"/>
	</v2_linearGradient>
</v2_fillEffect>

A three way gradient might be defined as shown in Illustration 10 where red is set at position 0, aqua is set at position 50, and fuchsia is set at position 100. The angle is set to 90 degrees.

Illustration 10: Linear Gradient configured for three colors
Illustration 10: Linear Gradient configured for three colors

The result in a chart is red fading into aqua fading into fuchsia as seen in Illustration 11.

Illustration 11: A bar from a Bar chart with a gradient consisting of three colors
Illustration 11: A bar from a Bar chart with a gradient consisting of three colors

The XML for three gradient colors in the ReportPresets.xml file looks like:

<v2_fillEffect defaultColor="#89AF47">
	<v2_linearGradient gradientAngle="90">
		<v2_gradientColor gradientColor="red"/>
		<v2_gradientColor gradientColor="aqua" colorPosition="50"/>
		<v2_gradientColor gradientColor="fuchsia" colorPosition="100"/>
	</v2_linearGradient>
</v2_fillEffect>

Again, the default color would be used if the selected fill effect were not supported for a given output format.

Image Fills

Images of several types such as JPG, BMP, GIF and PNG can be used as fills. Images can be placed into the fill area in various ways including top, bottom, left or right justified, stretched to fit and so on.

For example, a spaceship image seen in Illustration 12, can be used in a Column chart as seen in Illustration 13.

Illustration 12: Image of a spaceship
Illustration 12: Image of a spaceship
Illustration 13: Column chart using spaceship image as the fill for each bar
Illustration 13: Column chart using spaceship image as the fill for each bar
Illustration 13: Column chart using spaceship image as the fill for each bar

The XML definition in the ReportPresets.xml file looks like:

<v2_fillEffect>
	<v2_image URL="http://.../samples/images/rocket%20-%20red%20-%20small.bmp">
		<v2_imagePosition>
			<v2_stretchPosition/>
		</v2_imagePosition>
	</v2_image>
</v2_fillEffect>

Pattern Fills

Report Studio defines a small set of patterns to use where color or images are inappropriate such as black and white printed pages.

The available patterns are horizontal, vertical, cross, forwardDiagonal, backwardDiagonal and diagonalCross as seen in Illustration 14.

Illustration 14: Various palette patterns
Illustration 14: Various palette patterns

Horizontal is the default and will be used if no pattern name is specified.

By setting the foreground and background colors, a wide variety of effects is possible as seen in Illustration 15 where a horizontal pattern is combined with varying background colors, in this case, white and two different shades of grey.

Illustration 15: Horizontal pattern combined with various background colors
Illustration 15: Horizontal pattern combined with various background colors

The XML definition in the ReportPresets.xml file of a diagonalCross pattern with a silver background looks like:

<v2_fillEffect>
		<v2_pattern backgroundColor="silver" patternType="diagonalCross"/>
</v2_fillEffect>

Lines

Lines appear in line charts. Both solid color and gradient fills can be applied to lines. You can vary the line thickness (weight). Lines have their own small palette of patterns such as Solid, Dash, Dot and Dash dot, as seen in Illustration 16.

Illustration 16: Various line styles
Illustration 16: Various line styles

Lines can also have markers that appear at each inflection point. Therefore, a line palette may also define marker styles as well in the ReportPresets.xml file as shown below.

<v2_linePalette markerSize="5pt">
	<v2_linePaletteEntries>
		<v2_linePaletteEntry>
			<v2_pointPaletteEntry>
				<v2_fillEffect defaultColor="#8599D3">
					<v2_solidColor color="#8599D3" transparency="25"/>
				</v2_fillEffect>
			</v2_pointPaletteEntry>
			<v2_lineFill defaultColor="#8599D3">
				<v2_color color="#8599D3"/>
			</v2_lineFill>
		</v2_linePaletteEntry>
	... More line palette entries here
</v2_linePalette markerSize="5pt">

Markers

You can define the shape and color of markers used in scatter, point and line charts. Markers are also referred to as Points.

In a scatter chart, you have two options for marker shapes:

  1. Specified shapes for each item in the series
    • The circle shape is the default for out-of-the-box palettes.
    • On the chart element in the XML, the changeShapeByCategory attribute is set to false as shown below.
      <v2_scatterChart maxHotspots="10000" changeShapeByCategory="false"
    • The shape is specified in the palette unless using the default circle, in which case the element below will not appear.
      <v2_pointPaletteEntrymarkerShape="upTriangle">
  2. Different shapes for each category which overrides the series shape settings.
    • Specified on the Properties tab of the palette dialog
    • On the chart element in the XML, the changeShapeByCategory attribute is set to true as shown below.
      <v2_scatterChart maxHotspots="10000" changeShapeByCategory="true"

There is a large selection of marker shapes such as Vertical Bar, Notched Square, Cone, Dodecahedron, and so on, as seen in Illustration 17 below. A full listing of available shapes can be accessed in the chart's Palette dialog in IBM Cognos Report Studio.

Illustration 17: Various marker shapes available in the Palette dialog for the chart
Illustration 17: Various marker shapes available in the Palette dialog for the chart
Illustration 17: Various marker shapes available in the Palette dialog for the chart

Each marker can have the following attributes:

  • Size
    • Set through the Palette property dialog of the chart
    • Defaults to 5 points and can be changed through the Properties tab of the Palette property dialog
  • Fill Effect
    • Gradient
    • Pattern
    • Color
    • Image

In a simple ReportPresets.xml example, creating a Point palette that has blue “Up Triangles” looks like:

<v2_pointPalette>
	<v2_pointPaletteEntries>
		<v2_pointPaletteEntry markerShape="upTriangle">
			<v2_fillEffect defaultColor="#C7C7C7">
				<v2_solidColor color="blue"/>
			</v2_fillEffect>
		</v2_pointPaletteEntry>
	</v2_pointPaletteEntries>
</v2_pointPalette>

ReportPresets.xml Configuration File

Unlike IBM Cognos 8 where the palettes are defined in ChartPalettes.xml located in the <IBM Cognos install location>\webcontent\pat\res directory, palettes are now defined in ReportPresets.xml which is located in the same directory.

Note that ReportPresets.xml contains lots of presets, not just the palettes. We'll ignore everything else for purposes of this document.

Chart palettes are defined both in the XML report specification and in the palettes configuration file using the same syntax.

Each named palette that appears in the Report Studio user interface, when selecting a Palette preset as seen in Illustration 18, contains 4 palettes, one each for each of the four palette types.

Illustration 18: Chart Palette Presets selection dialog showing various palette presets
Illustration 18: Chart Palette Presets selection dialog showing various palette presets
Illustration 18: Chart Palette Presets selection dialog showing various palette presets

The four palette types plus the legacy IBM Cognos 8 palette are listed in the table below.

NameXML ElementUsage
IBM Cognos 8chartPaletteUsed for all IBM Cognos 8 charts
Solidv2_solidPaletteBar, column, pie, gauge, pie and pareto charts
Linev2_linePaletteLine
Pointv2_pointPaletteScatter and bubble
Progressivev2_ProgressivePaletteProgressive

A simplified example of palette presets in the ReportPresets.xml file:

<chartPalettePresets ... >

		... There will be many chartPalettePreset entries, one for each palette
		... By default there are 17 chart palettes defined in this file
		<chartPalettePreset ...>

			... Each chartpalettePreset defines one IBM Cognos 8 
				and 4 IBM Cognos 10 chart palettes

			... This is the IBM Cognos 8 chart palette
			<chartPalette>
				.... IBM Cognos 8 chart palette entries
			</chartPalette>

			... The IBM Cognos 10 chart palettes can appear in any order

			... The solid palette
			<v2_solidPalette>
				... Solid palette entries go here
			</v2_solidPalette>

			... The line palette
			<v2_linePalette>
				... Line palette entries go here
				... Each line palette entry will define both   
					a line and point styling
			</v2_linePalette>

			... The point palette
			<v2_pointPalette>
				... Point palette entries go here
			</v2_pointPalette>

			... The Progressive Palette
			<v2_progressivePalette>
				... Progressive chart palettes always define 4 
					entries with fills
					<v2_progressivePositiveValueFill>
						... Fill effect defined here
					</v2_progressivePositiveValueFill>
					<v2_progressiveNegativeValueFill>
						... Fill effect defined here
					</v2_progressiveNegativeValueFill>
					<v2_progressiveFirstValueFill>
						... Fill effect defined here
					</v2_progressiveFirstValueFill>
					<v2_progressiveTotalValueFill>
						... Fill effect defined here
					</v2_progressiveTotalValueFill>
			</v2_progressivePalette>
		</chartPalettePreset>

		.... More chart palettes

</chartPalettePresets>

Report Studio String Resources

Report Studio is a multilingual interface allowing users to choose their language of choice. Therefore, the strings, such as chart palette names, labels and tooltips, which appear in the UI are in fact translated to many languages and for that reason stored in string resource files. These string resource files are found in the <IBM Cognos BI install location>\webcontent\pat\res directory and have names in the form of reportstudio_<language code>.xml. For example, reportstudio_ja.xml is the string resource file name for Japanese and reportstudio_en.xml is used for English.

The string resource files structure consists of the unique string ID and the translated string. The ReportPresets.xml file label and tooltip entries refer to those strings using the unique IDs.

For example, this XML element from the ReportPresets.xml file has two unique IDs:

<chartPalettePreset 
	name="pal0"
	idsLabel="IDS_PAL_NAME_flow_default"
	idsTooltip="IDS_PAL_TOOLTIP_flow_default">

If we open the string resource files for the various languages we will see the section:

<section name="RSB" type="UI">

and within that section the strings:

English (reportstudio_en.xml)

<string 
	id="IDS_PAL_NAME_flow_default"
	type="List Item Label"
	usage="New default palette">
		Flow
</string>
<string
	id="IDS_PAL_TOOLTIP_flow_default"
	type="Tooltip"
	usage="New default palette">
		Flow (Default palette)
</string>

Italian ( reportstudio_it.xml)

<string>
	id="IDS_PAL_NAME_flow_default"
	type="List Item Label" 
	usage="New default palette">
		Flusso
</string>
<string
	id="IDS_PAL_TOOLTIP_flow_default"
	type="Tooltip"
	usage="New default palette">
		Flusso (tavolozza predefinita)
</string>

Each string resource file will contain language appropriate strings that correspond to the unique IDs.

The type and usage attributes are used by Report Studio and must be set as shown above for the idsLabel and idsTooltip elements in the ReportPresets.xml file.

You need only add the strings to the language files you intend to use.

As you will be creating our own custom chart palette, you can also invent your own unique IDs. It is suggested you make them easily identifiable as your own.

Chart Palette Images

Each palette has an associated image that appears in the Chart Palette Presets selection dialog as shown in Illustration 19.

Illustration 19: Chart Palette Presets selection dialog
Illustration 19: Chart Palette Presets selection dialog
Illustration 19: Chart Palette Presets selection dialog

These images are GIFs stored in the <IBM Cognos BI install location>\webcontent\pat\images\presets\chart_palettes directory and are identified by the name attribute of the chart palette element. For example, the first entry called “Flow” is specified in the ReportPresets.xml like this:

<chartPalettePreset 
	name="pal0"
	idsLabel="IDS_PAL_NAME_flow_default"
	idsTooltip="IDS_PAL_TOOLTIP_flow_default">

In the images directory we find the image pal0.gif as shown in Illustration 20.

Note: A palette image should have a transparent background but you can also use a white background as well if the Report Studio UI background is white as well.

Illustration 20: pal0.gif file
Illustration 20: pal0.gif file

Note: A palette image should have a transparent background but you can also use a white background as well if the Report Studio UI background is white as well.

Create a Sample Custom Palette

The steps to create a custom palette are as follows.

  1. Decide on a unique name, label and tooltip for your palette. These should be meaningful.
  2. Design or re-use a GIF image for the palette.
    You can re-use an existing image by copying and giving it a new name.
  3. Begin defining the custom palette in XML using the name, label and tooltip.
  4. Define the colors, gradients and so on you need in your chart. Remember that you need 5 definitions for this:
    • IBM Cognos 8 chart palette
    • Solid palette
    • Line palette
    • Point palette
    • Progressive palette
  5. Encode the palette as XML.
  6. Complete the XML definition.
  7. Backup the ReportPresets.xml files.
  8. Add your custom palette to the ReportPresets.xml files.
  9. Add your palette GIF image to the chart_palettes directory.
  10. Add your custom strings to the string resource file(s) as required.
  11. Re-start Report Studio.
  12. Try it out and correct any issues.

Note that the built-in palettes generally define 20 different entries. We will limit ourselves to 4 to save space in this document.

In the following example we will name our palette, GOS (for Great Outdoors Sales) and our label will be Great Outdoors.

Our tooltip will be Great Outdoors Sales Corporate Standard chart palette.

Image

Create an image with the appropriate palette colors and name it GOS.gif. The image should use the same dimensions as an existing palette GIF file found in <IBM Cognos BI install location>\webcontent\pat\images\presets\chart_palettes directory. Place the new image in the same directory.

You can re-use an existing palette image for quick testing of this example by copying it and renaming the copy to GOS.gif. Of course the palette colors in the image will not match the colors used in this example, but it will allow you to quickly see a new palette entry in the Chart Palette Presets selection dialog for this example.

Begin Defining the Custom XML

It is suggested that you assemble the required XML in a temporary XML file before editing the product ReportPresets.xml file.

The chartPalettePreset element is used to define each palette.

The label and tooltip in a custom chart palette will be defined using the label and tooltip attributes.

The resulting XML in this example looks like:

<chartPalettePreset name="GOS" idsLabel="GOS_palette_label" 
  idsTooltip="GOS_palette_tooltip">

The idsLabel and idsTooltip values are invented for this custom palette and must have matching entries in the string resource file(s).

Create the String Resources

Edit the appropriate language string resource file found in the <IBM Cognos BI install location>\webcontent\pat\res directory, such as reportstudio_en.xml, and add the two new string resources to the section called <section name="RSB" type="UI"> as shown below:

<section name="RSB" type="UI">
	<string id="GOS_palette_label" type="List Item Label" usage="New default palette">
		Great Outdoors
	</string>
	<string id="GOS_palette_tooltip" type="Tooltip" usage="New default palette">
		Great Outdoors Sales Corporate Standard chart palette
	</string>

Define the Sample Palette

In our sample palette we will have 4 entries.

The IBM Cognos 8 and Solid palettes will consist of four (linear) gradients, black to silver, green to lime, maroon to red, and navy to blue as shown in Illustration 21.

Illustration 21: Four linear gradients used in custom palette example
Illustration 21: Four linear gradients used in custom palette example

The Line palette will be four lines and points with the same gradients as the solid palette, with Silver, Green, Red and Blue colored circles as points. Default colors will be Silver, Green, Red and Blue.

The Point palette will be circles in Silver, Green, Red and Blue color.

The Progressive palette will be the same four gradients as the solid palette.

Encode the palette as XML

Each palette is defined as a child element to a chartpalettePreset element.

  1. To get the syntax for the required palettes, use Report Studio to create a report with the following charts:
    • IBM Cognos 8 column chart (to add a IBM Cognos 8 chart, from the Tools menu, click Options, click the Advanced tab, ensure Use legacy chart authoring is selected)
    • IBM Cognos 10 column chart
    • IBM Cognos 10 line chart
    • IBM Cognos 10 scatter chart
    • IBM Cognos 10 progressive chart
  2. On each chart configure the palette as defined earlier. You may have to add a data item to the Series and set the Palette property to do this.
  3. Select the series item. Use the /Tools/Show Specification (Selection) and copy the XML fragment to the Windows clipboard.
  4. Paste the XML fragment into your temporary XML file and delete all but the palette definition.
  5. Repeat this for each chart until you have created each palette.
    The palettes should appear as shown below.

    IBM Cognos 8 Chart Palette XML

    <chartPalette>
    	<chartGradient direction="right" toColor="silver"/>
    	<!--Above entry fromColor defaults to black-->
    	<chartGradient direction="right" fromColor="green" toColor="lime"/>
    	<chartGradient direction="right" fromColor="maroon" toColor="red"/>
    	<chartGradient direction="right" fromColor="navy" toColor="blue"/>
    </chartPalette>

    Solid Palette XML

    <v2_solidPalette>
    	<v2_solidPaletteEntries>
    		<v2_solidPaletteEntry>
    			<v2_fillEffect defaultColor="silver">
    				<v2_linearGradient>
    					<v2_gradientColor/>
    					<!--Entry above defaults to color black
    						Entry above defaults to position 0-->
    					<v2_gradientColor colorPosition="100"
    						gradientColor="silver"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_solidPaletteEntry>
    		<v2_solidPaletteEntry>
    			<v2_fillEffect defaultColor="green">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="green"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="lime"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_solidPaletteEntry>
    		<v2_solidPaletteEntry>
    			<v2_fillEffect defaultColor="red">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="maroon"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="red"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_solidPaletteEntry>
    		<v2_solidPaletteEntry>
    			<v2_fillEffect defaultColor="blue">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="navy"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="blue"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_solidPaletteEntry>
    	</v2_solidPaletteEntries>
    </v2_solidPalette>

    Line Palette XML

    <v2_linePalette markerSize="5pt">
    	<v2_linePaletteEntries>
    		<v2_linePaletteEntry>
    			<v2_lineFill defaultColor="silver">
    				<v2_linearGradient>
    					<v2_gradientColor/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="silver"/>
    				</v2_linearGradient>
    			</v2_lineFill>
    			<v2_pointPaletteEntry>
    				<v2_fillEffect defaultColor="silver">
    					<v2_solidColor color="silver"/>
    				</v2_fillEffect>
    			</v2_pointPaletteEntry>
    		</v2_linePaletteEntry>
    		<v2_linePaletteEntry>
    			<v2_lineFill defaultColor="green">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="#198545"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="lime"/>
    				</v2_linearGradient>
    			</v2_lineFill>
    			<v2_pointPaletteEntry>
    				<v2_fillEffect defaultColor="#198545">
    					<v2_solidColor color="#198545"/>
    				</v2_fillEffect>
    			</v2_pointPaletteEntry>
    		</v2_linePaletteEntry>
    		<v2_linePaletteEntry>
    			<v2_lineFill defaultColor="red">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="maroon"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="red"/>
    				</v2_linearGradient>
    			</v2_lineFill>
    			<v2_pointPaletteEntry>
    				<v2_fillEffect defaultColor="red">
    					<v2_solidColor color="red"/>
    				</v2_fillEffect>
    			</v2_pointPaletteEntry>
    		</v2_linePaletteEntry>
    		<v2_linePaletteEntry>
    		<v2_lineFill defaultColor="blue">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="navy"/>
    					<v2_gradient ColorcolorPosition="100" 
    						gradientColor="blue"/>
    				</v2_linearGradient>
    			</v2_lineFill>
    			<v2_pointPaletteEntry>
    				<v2_fillEffect defaultColor="blue">
    					<v2_solidColor color="blue"/>
    				</v2_fillEffect>
    			</v2_pointPaletteEntry>
    		</v2_linePaletteEntry>
    	</v2_linePaletteEntries>
    </v2_linePalette>

    Point Palette XML

    <v2_pointPalette markerSize="5pt" markerBorders="show">
    	<v2_pointPaletteEntries>
    		<v2_pointPaletteEntry>
    			<v2_fillEffect defaultColor="silver">
    				<v2_linearGradient>
    					<v2_gradientColor/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="silver"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_pointPaletteEntry>
    		<v2_pointPaletteEntry>
    			<v2_fillEffect defaultColor="green">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="green"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="lime"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_pointPaletteEntry>
    		<v2_pointPaletteEntry>
    			<v2_fillEffect defaultColor="red">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="maroon"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="red"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_pointPaletteEntry>
    		<v2_pointPaletteEntry>
    			<v2_fillEffect defaultColor="blue">
    				<v2_linearGradient>
    					<v2_gradientColor gradientColor="navy"/>
    					<v2_gradientColor colorPosition="100" 
    						gradientColor="blue"/>
    				</v2_linearGradient>
    			</v2_fillEffect>
    		</v2_pointPaletteEntry>
    	</v2_pointPaletteEntries>
    </v2_pointPalette>

    Progressive Palette XML

    <v2_progressivePalette>
    	<v2_progressivePositiveValueFill>
    		<v2_fillEffect defaultColor="silver">
    			<v2_linearGradient>
    				<v2_gradientColor/>
    				<v2_gradientColor colorPosition="100" 
    					gradientColor="silver"/>
    			</v2_linearGradient>
    		</v2_fillEffect>
    	</v2_progressivePositiveValueFill>
    	<v2_progressiveNegativeValueFill>
    		<v2_fillEffect defaultColor="green">
    			<v2_linearGradient>
    				<v2_gradientColor gradientColor="green"/>
    				<v2_gradientColor colorPosition="100" 
    					gradientColor="lime"/>
    			</v2_linearGradient>
    		</v2_fillEffect>
    	</v2_progressiveNegativeValueFill>
    	<v2_progressiveFirstValueFill>
    		<v2_fillEffect defaultColor="red">
    			<v2_linearGradient>
    				<v2_gradientColor gradientColor="maroon"/>
    				<v2_gradientColor colorPosition="100" 
    					gradientColor="red"/>
    			</v2_linearGradient>
    		</v2_fillEffect>
    	</v2_progressiveFirstValueFill>
    	<v2_progressiveTotalValueFill>
    		<v2_fillEffect defaultColor="blue">
    			<v2_linearGradient>
    				<v2_gradientColor gradientColor="navy"/>
    				<v2_gradientColor colorPosition="100" 
    					gradientColor="blue"/>
    			</v2_linearGradient>
    		</v2_fillEffect>
    	</v2_progressiveTotalValueFill>
    </v2_progressivePalette>
  6. The last piece of XML is the closing chartPalettePreset tag as shown below.
    </chartPalettePreset>
  7. Backup the ReportPresets.xml files located in <IBM Cognos BI install location>\webcontent\pat\res.
  8. Add your custom palette to the ReportPresets.xml file by adding the new XML nested under the <chartPalettePresets> element. Note that the order the chartPalettePreset elements appear in this file is the order they will appear in the Report Studio palette interface.
  9. Copy the modified string resource file(s), ReportPresets.xml and the palette image GIFs to their appropriate location on all IBM Cognos BI gateway machines.
  10. Clear your browser cache, re-start Report Studio, and test your new palette.

Downloadable resources


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Big data and analytics, Information Management
ArticleID=681998
ArticleTitle=IBM Cognos Proven Practices: Create Custom Palettes in IBM Cognos 10 Report Studio
publish-date=06222011