Hi folks -
I'm trying to use treemaps' colorMappingBy: id to keep the color consistent
for an item when its values change. For instance, if I use
option = {
series: [
{
type: 'treemap',
colorMappingBy: 'id',
data: [
{
id: 'a',
name: 'a',
value: 10
},
{
id: 'b',
name: 'b',
value: 8
},
{
id: 'c',
name: 'c',
value: 3
},
{
id: 'd',
name: 'd',
value: 20
}
]
}
]
};
in https://echarts.apache.org/examples/en/editor.html?c=treemap-simple
"a" gets a (default) color of green. But, if you change a's value to 100,
it changes to blue (and all the other items also change). I found that I
can hardcode the items color like:
{
"name": "a",
"value": 10,
"itemStyle": {
"color": "#3ba272"
}
}
but that's not theme friendly. I can't help but think I'm doing it wrong,
but can't find the right magic. Any pointers?
thanks!
miles