Open domsle opened 3 years ago
Ah, I see the issue. Let me think of possible solutions, the nested tree-like structure of the sankey makes this more difficult I think
If this is what you are after... ...take a look at this code. It uses a different library, but can give you an idea on how to structure your data. BTW, your last attempt has correct node data, just have to find a way to replace the preset one.
Is it possible to set only some of the node's colors, while keeping the unset at the theme's default values?
Yes, you can define only colors for a,b,c,d, and leave e,f,g,etc. as default.
I am trying to assign each node of sankey chart with a color.
In case of my data, looking like this:
The resulting chart without any colors being set, works and looks like that:
If I would add colors
e_add('itemStyle', color)
to the code:I will get error of:
Now after playing a bit with easier and simplier examples, I came to realise, that this is probably not as easy as each row's color being assigned to each source node (my initial assumption). When I plot just first 7 rows, it works, but the color of all nodes is exactly the same:
I think that the problem is, that for whatever reason the colors are not translated into the right place in the chart object.
e_inspect
on the code above results in these subsets of the whole object:For the record, I dont see any instance of label "f" or "b" with the colors that are assigned here.
My last attempt was creating a list with similar layout, and assigning it to the e_sankey's data argument, so it looks like that:
But this does not solve the problem either, resulting in a chart object looking like that: There are two lists named data inside of [['series']][[1]], but none of them contains the passed list.
Is it possible to set only some of the node's colors, while keeping the unset at the theme's default values?
As a side note I think that maybe the
e_color
could be a helpful here, but I think it is not a solution, since e_sankey does not accept factors.