Hello,
I’m trying to create a customised stacked bar chart showing income and expenses in separate colour schemes like on the pic. Is this possible?
I’ve almost made my notebook look right with the colour bit outstanding. I hope I haven’t massacred the other parts of the code too much — I’m sure there’s a cleaner way to do it.
Thanks!
1 Like
Fil
March 1, 2023, 1:30pm
2
There is only one color scale in Plot, but you can solve the problem differently:
encode the kategoria as color (fill), and the kwota as opacity:
fill: "kategoria",
fillOpacity: "kwota",
alternatively:
compute all your colors outside of Plot, and pass them as css color strings:
scale1 = d3.scaleLinear([0, 800], ["white", "orange"]); // outside of Plot
scale2 = d3.scaleLinear([0, 800], ["white", "steelblue"]);
fill: d=> d. kategoria === "Wydatki" ? scale1(d.kwota) : scale2(d.kwota), // in Płot
1 Like