apache-superset中的label_colour键存储在哪里?

时间:2019-01-23 12:09:05

标签: css json superset apache-superset

版本:来自here

的Docker实例

根据docs,我可以根据标签编辑颜色;

  

通过使用JSON Metadata键在label_colors属性中提供标签到颜色的映射,可以在每个仪表板上进行操作。

通过调整如下所示的JSON;

enter image description here

enter image description here

我的JSON代码在哪里;

{
"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 个答案:

答案 0 :(得分:4)

提供赏金后不久,我发现了拼图的缺失部分。

需要对代码进行少量编辑,因为键必须使用小写字母,以便变得;

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

但是,如果您将图表颜色方案设置为超出默认选项的任何值,这仍然不会显示预期的颜色方案。将cahrt配色方案设置回默认值,您应该得到想要的。在我的构建默认为;

enter image description here

要对此进行测试,请转到示例仪表板births并编辑仪表板>编辑仪表板元数据,如下所示更改JSON元数据;

{"filter_immune_slices": [], "timed_refresh_immune_slices": [], 
"filter_immune_slice_fields": {}, "expanded_slices": {}, "label_colors": 
{"boy": "#9DCB3C","girl": "#F7AF1D"}, 
"default_filters": "{}"}