Skip to content

Negative numbers clipped in StackedBar #67

@unhammer

Description

@unhammer

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.
bilde

How to reproduce

<svg class="chart"></svg>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions