Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative numbers clipped in StackedBar #67

Open
unhammer opened this issue Mar 28, 2020 · 2 comments
Open

Negative numbers clipped in StackedBar #67

unhammer opened this issue Mar 28, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@unhammer
Copy link

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

@unhammer unhammer added the bug Something isn't working label Mar 28, 2020
@timqian timqian self-assigned this Mar 31, 2020
@timqian
Copy link
Owner

timqian commented Mar 31, 2020

Thanks @unhammer I will look into it when I got time

@xiaoyu2006
Copy link
Contributor

xiaoyu2006 commented Jul 25, 2020

截屏2020-07-25 13 49 21

I don't think this one works well... Maybe I should try another way.

NOTE

I have tested every kind of graph. Only the two "Bar charts" and "Radar" have this bug.

NOTE

I think to fix the disappearance, we can add a customizable padding on the y-axis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants