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

Dataset is displayed on other scale than configured via axisID #6320

Closed
Nas3nmann opened this issue Jun 5, 2019 · 2 comments · Fixed by #6321
Closed

Dataset is displayed on other scale than configured via axisID #6320

Nas3nmann opened this issue Jun 5, 2019 · 2 comments · Fixed by #6321
Milestone

Comments

@Nas3nmann
Copy link

Nas3nmann commented Jun 5, 2019

Expected Behavior

After calling update() on a consistent chart configuration with an additional unused axis I would expect the datasets to be displayed on the correct axes.

Current Behavior

One dataset is displayed on the additional unused axis.
Additionally the 'unused' axis is displayed 'overlayed', but that's not what this bug report is about.

Possible Solution

Steps to Reproduce (for bugs)

Bug can be reproduced with this codepen: https://codepen.io/nas3nmann/pen/XwGLbg?editors=1010

Here are the steps in detail:

  1. Create time based chart with one dataset and two yAxes (named 'y1' and 'unused'), one not displayed and unused, the other assigned to the dataset via yAxisID
  2. Add a second dataset without axisID. Call chart update().
  3. Remove 'y1' axis
  4. Push new axis configuration for two similar axes 'y1' (again) and 'y2'.
  5. Assign axes 'y1' to dataset 1 and 'y2' to dataset 2. Call chart update().
  6. Change "display" property of unused axis to "true"

Context

I was trying to add new data to the chart and refresh the axis configuration while keeping a separate axis for other purposes non visible.

If i remove the chart.update() call after adding the second dataset, it is correctly displayed on axis 'y2'.
I'm doing these updates because i was running into this issue from time to time: #5149

Environment

  • Chart.js version: 2.8.0
  • Browser name and version: Firefox 60.6.2esr (32-Bit)
@nagix
Copy link
Contributor

nagix commented Jun 6, 2019

To fix the issue of the 'unusedY' axis overlaying the 'y1' axis, add window.myChart.update() after displayUnusedAxis().

The issue of the 'My second dataset' sticking to the 'unusedY' axis seems to be a bug. The change in data.dataset[1].yAxisID is not reflected in data.dataset[1]._meta[0].yAxisID.

@Nas3nmann
Copy link
Author

To fix the issue of the 'unused axis' axis overlaying the 'y1' axis, add window.myChart.update() after displayUnusedAxis().

You are right. I missed that in my codepen. Just fixed this so it does not distract from the real bug.

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

Successfully merging a pull request may close this issue.

2 participants