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

Support object values for bar charts #6323

Merged
merged 4 commits into from
Jun 19, 2019
Merged

Conversation

nagix
Copy link
Contributor

@nagix nagix commented Jun 7, 2019

This PR resolves the following problems:

  1. Fixed misplaced data points on category scale #4062 fixed the issue of object values ({x, y}) for category scales, but if the label is a falsy value such as 0 and '', that point is not correctly handled.
  2. Object values don't fully work for category scales in bar chars because getPixelForValue doesn't accept datasetIndex to handle object values for the ruler in bar charts.

Note that bars for the same label won't be stacked even if the stack options are enabled because the current implementation only supports index-based stacking, not label-based stacking. That is not the scope of this PR. So, a bar will simply overlay the other bars with the same label.

Master: https://jsfiddle.net/nagix/yhzsgnae/
Screen Shot 2019-06-08 at 12 18 03 AM

This PR: https://jsfiddle.net/nagix/zpcou3Lh/
Screen Shot 2019-06-08 at 12 18 23 AM

The motivation of this PR is to support this type of 'column range chart' as well as gantt chart. I will open another PR to add support for object values for floating bars.

Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. just one small comment

src/scales/scale.category.js Outdated Show resolved Hide resolved
@nagix
Copy link
Contributor Author

nagix commented Jun 8, 2019

I also refactored the entire category scale code. It is reduced by 154 bytes.

benmccann
benmccann previously approved these changes Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants