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

zoom with type 'drag': $$.unexpandBars is not a function #1760

Closed
Nicolas469 opened this issue Nov 4, 2020 · 1 comment
Closed

zoom with type 'drag': $$.unexpandBars is not a function #1760

Nicolas469 opened this issue Nov 4, 2020 · 1 comment

Comments

@Nicolas469
Copy link
Contributor

Nicolas469 commented Nov 4, 2020

Description

Can't zoom with type 'drag'.

Steps to check or reproduce

A) Billboard imported in a Angular project with npm i billboard.js

B) import bb, { bar as bbBar, line as bbLine, subchart as bbSubchart, zoom as bbZoom } from 'billboard.js';

bb.generate({
  data: {
    columns: [['sample', 30, 200, 100, 400, 150, 250]],
    type: bbLine()
  },
  zoom: {
    enabled: bbZoom(),
    type: 'drag'
  },
  bindto: `#chart-${this.chartAreaId}`
});

C) Zoom on chart
D) This will not zoom and will display an error in console:

core.js:4352 ERROR TypeError: $$.unexpandBars is not a function
    at Chart.hide (billboard.esm.js:8900)
    at Chart.zoom (billboard.esm.js:17396)
    at SVGGElement.<anonymous> (billboard.esm.js:18475)
    at Dispatch.apply (dispatch.js:61)
    at customEvent (on.js:103)
    at Object.gesture (drag.js:137)
    at mouseupped (drag.js:76)
    at on.js:27
    at ZoneDelegate.invokeTask (zone.js:407)
    at Object.onInvokeTask (core.js:27474)

## [Part of] Solution
billboard.esm.js:8900: change
        $$.unexpandCircles();
        $$.unexpandBars();
and put
        $$.unexpandCircles && $$.unexpandCircles();
        $$.unexpandBars && $$.unexpandBars();

since unexpandBars() is defined only for bar chart (the same thing can append with unexpandCircles()).

@netil netil added the bug label Nov 5, 2020
@netil
Copy link
Member

netil commented Nov 5, 2020

Hi @Nicolas469, thanks for report!

netil added a commit to netil/billboard.js that referenced this issue Nov 5, 2020
The call of tooltip.hide(), unexpad of circles & bars internal methods are called.
They're extended when line() or bar() modules are imported and called for esm env.

Ref naver#1760
@netil netil closed this as completed in f2787fa Nov 5, 2020
netil pushed a commit that referenced this issue Nov 11, 2020
## [2.1.4](2.1.3...2.1.4) (2020-11-11)

### Bug Fixes

* **api:** fix tooltip showing when lesser data loaded ([74320cf](74320cf)), closes [#1761](#1761)
* **event:** fix referencing event element ([38568c1](38568c1)), closes [#1752](#1752)
* **gauge:** fix to be consistent max label value ([0c2006f](0c2006f)), closes [#1759](#1759)
* **radar:** fix labels showing on esm usage ([d56ff52](d56ff52)), closes [#1765](#1765)
* **shape:** shape not showing on ie11 ([d1366d1](d1366d1)), closes [#1758](#1758)
* **tooltip:** fix to reset pending events from .show() ([ce8210c](ce8210c)), closes [#1753](#1753)
* **zoom:** fix throwing TypeError during zoom  ([f2787fa](f2787fa)), closes [#1760](#1760)
@netil netil added the released label Nov 11, 2020
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