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

[BUG] Fill didn't start from zeroLine in mixed lines/bar chart #4668

Closed
qiluo opened this issue Aug 17, 2017 · 5 comments
Closed

[BUG] Fill didn't start from zeroLine in mixed lines/bar chart #4668

qiluo opened this issue Aug 17, 2017 · 5 comments

Comments

@qiluo
Copy link

qiluo commented Aug 17, 2017

Expected Behavior

There are two lines and a bar in a mixed type chart, I want to fill space between these two lines,

new Chart(ctx, {
    type: 'bar',
    data: {
        datasets: [
            {...} ,           // this is a bar
            {fill: '+1'},      // this is a line
            {fill: false},      // this is another line
        ]
    }
})

but I found the fill didn't start from index zero,

But in a lines only chart, the fill worked as expected, starting from index 0. Just removed bar from above demo

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

Context

Environment

  • Chart.js version: 2.6
  • Browser name and version: Ionic (WebView)
  • Link to your project:
@nagix
Copy link
Contributor

nagix commented Aug 17, 2017

I think this is not a bug, and the behavior of a line-only chart has changed by #4545 so that a line starts from the midpoint of grid lines with or without bars. There are no options to simply extend these lines.

As a workaround, you can add extra columns at the beginning and end, and use ticks.min and ticks.max options. By the way, 2.6 has an issue about fill area clipping (#4450), so you need the version from the latest master.

See https://jsfiddle.net/zkr59bfx/

@qiluo
Copy link
Author

qiluo commented Aug 17, 2017

@nagix really appreciated your quick reply, you almost recreated the chart by just referring to my snapshot and the solution worked perfectly!

@etimberg
Copy link
Member

Closing as answered. Thanks @nagix

@qiluo
Copy link
Author

qiluo commented Aug 24, 2017

@nagix another issue

issue

if I used stepLine, the fill area still not correct no matter what I set stepLine to 'before' or 'after'

@nagix
Copy link
Contributor

nagix commented Aug 25, 2017

@qiluo This seems a bug in the filler plugin. I opend #4696.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants