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

Bar chart for only dataset.data value #4907

Closed
GTDunk opened this issue Oct 31, 2017 · 1 comment
Closed

Bar chart for only dataset.data value #4907

GTDunk opened this issue Oct 31, 2017 · 1 comment

Comments

@GTDunk
Copy link

GTDunk commented Oct 31, 2017

Starting from version 2.7.0 'Bar chart' have changed the logic of showing data values: if there is only one value inside dataset.data the chart spreads the data on full width.

Expected Behavior

" If these are set to an array value, the first value applies to the first bar, the second value to the second bar, and so on."(http://www.chartjs.org/docs/latest/charts/bar.html)

The example with Chartjs version 2.6.0: https://codepen.io/GTDunk/pen/gXpPwJ

image

Current Behavior

The example with Chartjs version 2.7.1: https://codepen.io/GTDunk/pen/pdzYvJ

image

Possible Solution

How about a flag which could change the behavior?

Environment

  • Chart.js version: 2.6.0 & 2.7.1
  • Browser name and version: chrome ^58
@simonbrunel
Copy link
Member

It looks like a bug to me, it would behave like that if you specified your data as [{y: 2, t: date}] but in your case your data is an array that should map to your labels. Actually, if you add one data value, it works as expected data: [2,0], so I guess there is a special case that handles a single data value which is bugged.

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

No branches or pull requests

2 participants