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

Error when hiding y2 axis, but having y2 data #1016

Closed
pakerhoi opened this issue Aug 8, 2019 · 1 comment
Closed

Error when hiding y2 axis, but having y2 data #1016

pakerhoi opened this issue Aug 8, 2019 · 1 comment

Comments

@pakerhoi
Copy link
Contributor

pakerhoi commented Aug 8, 2019

Description

The billboardjs chart fails with error, when using axis.y2.show: false with y2 axis data.

Error:

Error in /turbo_modules/billboard.js@1.10.0/dist/billboard.js (8719:86)
yScaleGetter.call(...) is not a function

Expected behaviour

The chart should show a line of data that is related to the y2 axis, but y2 axis scale itself should be hidden. Note, that y axis can be hidden with axis.y.show: false and there is no error.

This worked well in the previous versions, but started to fail after an upgrade.

If this behaviour is by design, please update the docs to elaborate what axis.y.show: false does and find another way to hide the y2 axis. Also the way y axis works should be consistent with how y2 axis works.

Steps to check or reproduce

The code to reproduce:

import "billboard.js/dist/theme/insight.css";
import bb from "billboard.js";

var chart = bb.generate({
  data: {
    columns: [
      ["data2", 50, 20, 10, 40, 15, 25]
    ],
    axes: {
      data2: "y2"
    }
  },
  axis: {
    y2: {
      show: false,
    }
  },
  bindto: "#additionalYAxis"
});

See it live here:
https://stackblitz.com/edit/v6mvnu-sld8qb?file=index.js

@netil netil added the question label Aug 9, 2019
@netil
Copy link
Member

netil commented Aug 9, 2019

Hi @pakerhoi, this is intended design, basically to not generate unused nodes(#717).
The changes was applied since 1.8.0.

To make work, set axis.y2.show=true and control the visibility by css.

.bb-axis-y2 {
	display: none;
}

I'll be adding this info on APIs doc.

netil added a commit that referenced this issue Aug 9, 2019
Add note about 'y2' axis node generation.
[skip ci]

Ref #1016
@netil netil added the doc label Aug 9, 2019
@netil netil closed this as completed Oct 23, 2019
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