IBM Support

How to Create a Legend for a Custom Palette

Question & Answer


Question

A chart with a custom palette is created within IBM Cognos Report Studio. After doing so, the colors in the default legend no longer reflect those that display in the chart. How do I hide the default legend and create a new legend for my custom palette?

Answer

In order to display the same colors for both the chart and the legend, create your own legend using a repeater table and conditional styles.

The steps below provide a general guide however some object properties, such as border style and box padding, may need to be modified depending on the existing report layout to meet presentation requirements.

  1. Select the default legend on the chart from the page layout and delete it.
  2. From the toolbar, drag in a new table with one row and two columns
  3. Move the chart into the first cell.
  4. From the toolbar, drag a repeater table to the second cell.
  5. From the toolbar, drag a text item into the repeater table with a single space entered as text.
  6. From the data items tab, drag the data item on which the conditional palette is applied.
  7. Select the text item, then select Conditional Styles from the right-hand properties pane.
  8. Click New Conditional Styles then select Advanced Conditional Style.
  9. Create new conditions which mirror your conditional palette conditions.
  10. Click the Edit Pencil on each new condition and change the background color to the associated color in your conditional palette.
  11. Hit OK on the Conditional Styles windows to close them.

In this example, a table was used to space the chart and legend appropriately but other implementations, such as blocks, may be more appropriate depending on the the specific report design requirements. The repeater table and conditional styles are used in combination to implement the actual legend.

[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Report Studio","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.2.2;10.2.1;10.2;10.1.1;10.1;8.4.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 June 2018

UID

swg21632538