mhkeller / layercake

graphics framework for sveltejs
https://layercake.graphics
MIT License
1.36k stars 31 forks source link

examples: Modify components to support negative bars and columns #181

Open mhkeller opened 6 months ago

mhkeller commented 6 months ago

Pretty easy fix here. On the column chart make these two adjustments:

 $: columnHeight = d => {
    return Math.abs($yGet(d) - $yScale(0) );
  };

and

y="{Math.min($yScale(0), $yGet(d))}"

Pretty similar for the bar chart component. Not sure if these need to be added to the stacked components? That seems like a weird chart type...

mhkeller commented 1 month ago

After looking into this a bit, supporting all cases is a little tricky to handle in the component itself.