CCC Heat Grid - assigning colors to discrete values - colorMap not working

882 Views Asked by At

I have a CCC Heat Grid component where the data "value" (traffic_light in the example below) is always either 1, 2, 3 or null - and I want to color the Heat Map cells so that all 1s are green, all 2s are yellow and all 3s are red. I cannot use the "colors" array available in CDE because if my dataset doesn't contain one of the possible values, the next color in the array is assigned and the colors get messed up. So I think I need to attack this with javascript.

I have tried to use a colorMap, which I have successfully used on Bar Charts, but in the Heat Grid it doesn't appear to do anything at all - it just continues to use the default color scheme, changing colors depending on what data is in the dataset.

I have the following code in Post-Fetch on the Heat Grid component:

function f() {
    this.chartDefinition.colorMap = {
        "1": "green",
        "2": "yellow",
        "3": "red"
    };  
}

A sample of the output from the data set is as follows:

competency_name     full_name   expiry_date     traffic_light
Drilling Licence    ACKERLEY    NULL            3
Drivers Licence     ACKERLEY    NULL            3
Heavy Machinery     ACKERLEY    NULL            3
Project Management  ACKERLEY    NULL            3
Drilling Licence    ALBRIGHT    2016-10-05      2
Heavy Machinery     ALBRIGHT    2017-09-05      1
Project Management  ALBRIGHT    NULL            1
Project Management  ANDERSON    NULL            3
Heavy Machinery     ARMSTRONG   NULL            3
Drilling Licence    BAILEY      NULL            3

Other potentially relevant CDE settings:

  • crossTabMode = True
  • seriesInRows = False
  • categoryRole = category
  • seriesRole = category2
  • sizeRole =
  • colorRole = value
  • colorScaleType = Discrete


Am I missing something? There seems to be something specific to a Heat Grid (or to the structure of my data) that I need to do differently, but I can't figure it out. Any help appreciated.

I am using Pentaho 5.2, running version 16.01.22 of CDF, CDA, CDE and CGG

1

There are 1 best solutions below

0
whitegoose On

I couldn't figure out how to delete this thread - if an admin reads this, please go ahead if you think it's appropriate.

In the end I deleted my Heat Grid component and recreated it... and the problem was no longer there - the standard colors array option works fine, no need for any javascript.