andredumas/techan.js

Custom class per supstance

Closed this issue · 1 comments

Hi,

How can I add a custom class for a substance? I would like to have supstances on the same side with different colors. The substance takes a value, start and end, but I would like to add a class to that as well so I can change the color in the CSS.
Is there a way to do that already, or does that require a library change?

Thanks!!

NVM, found a way to do it :)

svg.selectAll("g.supstances")
  .datum(supstanceData)
  .call(supstance)
  .call((a) => a.selectAll(".scope-supstance").attr("class", (d) => ".scope-supstance " + d.color));