Where are label_colour keys stored in apache-superset?
Asked Answered
S

1

9

Version: Docker instance from here

According to the docs I can edit colours based on labels;

It is possible on a per-dashboard basis by providing a mapping of labels to colors in the JSON Metadata attribute using the label_colors key.

By adjusting the JSON found as below;

enter image description here

enter image description here

Where my code for JSON is;

{
"filter_immune_slices": [],
"timed_refresh_immune_slices": [],
"filter_immune_slice_fields": {},
"expanded_slices": {},
"label_colors": {
"A": "#007F3D",
"B": "#2C9F29",
"C": "#9DCB3C",
"D": "#FFF200",
"E": "#F7AF1D",
"F": "#ED6823",
"G": "#E31D23"
},
"default_filters": "{}"
}
Shush answered 23/1, 2019 at 12:9 Comment(1)
what about default linear scale for instance? Or how to change Heatmap's scheme colors?Pice
S
7

Shortly after offering a bounty I figured out the missing piece of the puzzle..

The code needed a slight edit as keys needed to be lower case so that became;

{
"filter_immune_slices": [],
"timed_refresh_immune_slices": [],
"filter_immune_slice_fields": {},
"expanded_slices": {},
"label_colors": {
"a": "#007F3D",
"b": "#2C9F29",
"c": "#9DCB3C",
"d": "#FFF200",
"e": "#F7AF1D",
"f": "#ED6823",
"g": "#E31D23"
},
"default_filters": "{}"
}

However this will still not show the intended colour scheme if you have set the chart colour scheme to anything over than the default option. Set the cahrt colour scheme back to the default and you should get what you want. Default on my build is;

enter image description here

To test this go to the example dashboard births and edit dashboard > edit dashboard metadata change the JSON Metadata as below;

{"filter_immune_slices": [], "timed_refresh_immune_slices": [], 
"filter_immune_slice_fields": {}, "expanded_slices": {}, "label_colors": 
{"boy": "#9DCB3C","girl": "#F7AF1D"}, 
"default_filters": "{}"}
Shush answered 31/1, 2019 at 16:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.