Negative numbers clipped in StackedBar
unhammer opened this issue · 2 comments
unhammer commented
Describe the bug
Negative numbers in datasets are not shown in StackedBar, mess up labels, or end up going below the origin even for the "positive stack"
Screenshot
If applicable, add screenshots to help explain your problem.
How to reproduce
<svg class="chart"></svg>
<script src="https://cdn.jsdelivr.net/npm/chart.xkcd@1.1/dist/chart.xkcd.min.js"></script>
<script>
const svg = document.querySelector('.chart');
new chartXkcd.StackedBar(svg, {
data: {
labels: ["normal","-20","-30"],
datasets: [{
label: 'Red',
data: [10,-20,-30],
}, {
label: 'Blue',
data: [20,20,20],
}],
}
});
</script>
or see https://jsfiddle.net/3dpbg241/
Additional context
I'd expect at least the positive dataset to stay above the line, and the labels to match up. Preferably, I'd get the "Red" in the example going below the line, and "Blue" above, and the Ylabel line would continue below the origin.
xiaoyu2006 commented