Skip to content

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

@Nas3nmann

Description

@Nas3nmann

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions