-
-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
I'm trying to render a stacked bar chart, but I'm running into some rendering problems when I have "missing" data.
I think the culprit is that the top of the stack is tied to the last entry, which makes the rendering weird when that is missing. I've adopted the example from the documentation and removed some entries to showcase the issue.
<script lang="ts">
import { BarChart } from 'layerchart';
const wideData = [
{
year: 2019,
apples: 3840,
bananas: 1920,
cherries: 960,
grapes: 400
},
{
year: 2018,
apples: 1600,
bananas: 1440,
cherries: 960,
},
{
year: 2017,
},
{
year: 2016,
apples: 820,
bananas: 560,
cherries: 720
}
];
</script>
<div class="h-[300px] rounded-sm border p-4">
<BarChart
data={wideData}
x="year"
series={[
{ key: 'apples', color: 'var(--color-danger)' },
{
key: 'bananas',
color: 'var(--color-warning)'
},
{
key: 'cherries',
color: 'var(--color-success)'
},
{
key: 'grapes',
color: 'var(--color-info)'
}
]}
seriesLayout="stack"
props={{
xAxis: { format: 'none' },
yAxis: { format: 'metric' },
tooltip: {
header: { format: 'none' }
}
}}
legend
renderContext="svg"
/>
</div>
Metadata
Metadata
Assignees
Labels
No labels