Where are label_colour keys stored in apache-superset?

感情迁移 提交于 2019-12-07 05:08:09

问题


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;

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": "{}"
}

回答1:


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;

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": "{}"}


来源:https://stackoverflow.com/questions/54326962/where-are-label-colour-keys-stored-in-apache-superset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!