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

Assign unique scale IDs #6291

Merged
merged 1 commit into from Jun 9, 2019
Merged

Assign unique scale IDs #6291

merged 1 commit into from Jun 9, 2019

Conversation

nagix
Copy link
Contributor

@nagix nagix commented May 22, 2019

If the first x or y scale has id: 'x-axis-1' or 'id: y-axis-1', and more scales are added without id, ID will be duplicated, and the they will not be correctly configured.

The example below shows that only 2 scales are configured in a scatter chart even if the config has 3 scales because the default scale IDs in scatter charts are 'x-axis-1' and 'y-axis-1' but the controller try to assign a number using the array index starting from 0.

This PR fixes it by checking the existing IDs to assign unique one.

Master: https://jsfiddle.net/nagix/6ar792zo/
Screen Shot 2019-05-23 at 12 13 09 AM

This PR: https://jsfiddle.net/nagix/dLs956je/
Screen Shot 2019-05-23 at 12 13 22 AM

@nagix nagix added this to the Version 2.9 milestone Jun 9, 2019
@nagix nagix merged commit bf094c5 into chartjs:master Jun 9, 2019
@nagix nagix deleted the issue-6291 branch June 9, 2019 07:45
charlesmass pushed a commit to charlesmass/Chart.js that referenced this pull request Jun 17, 2019
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
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.

None yet

4 participants