techniq / layerchart

Composable Svelte chart components to build a wide range of visualizations
https://www.layerchart.com
MIT License
663 stars 12 forks source link

PieChart: Legend wont change when underlying data changes #289

Open hayzamjs opened 13 hours ago

hayzamjs commented 13 hours ago

I have the following code:

<PieChart
    cornerRadius={5}
    outerRadius={sizes.chart.pie.outerRadius}
    innerRadius={-45}
    data={selectedChart}
    cRange={colorRange}
    key="label"
    value="value"
>
    <Legend
        classes={{
            root: 'flex',
            label: 'text-neutral-400 dark:text-neutral-200'
        }}
        placement="bottom-left"
        orientation="horizontal"
        variant="swatches"
        slot="legend"
    />
</PieChart>

When the underlying data selectedChart changes, the pie chart updates, but the legend stays the same, is there a way to force update the legend too?