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

Tooltip show false throws an error #1715

Closed
elielr01 opened this issue Oct 10, 2020 · 1 comment
Closed

Tooltip show false throws an error #1715

elielr01 opened this issue Oct 10, 2020 · 1 comment

Comments

@elielr01
Copy link

Hi, guys. I noticed that my gauge chart was throwing an error as soon as I hide the tooltips. This is the error:

Uncaught TypeError: Cannot read property 'style' of null
    at ChartInternal.hideTooltip (billboard.esm.js?25f5:7000)
    at unselectArc (billboard.esm.js?25f5:14768)
    at SVGPathElement.eval (billboard.esm.js?25f5:14799)
    at SVGPathElement.eval (on.js?0165:27)

My chart configuration:

const chart = bb.generate({
      legend: {
        show: false
      },
      tooltip: {
        show: false
      },
      color: {
        pattern: [
          colors['dark-red'],
          colors.red,
          colors.orange,
          colors.yellow,
          colors.green
        ],
        threshold: {
          values: [9, 29, 69, 89, 100]
        }
      },
      data: {
        columns: [['rating', 70]],
        type: gauge()
      },
      bindto: `#chart`
    })

According to the error stack, it seems that the problem is in the following part:

hideTooltip(force?: boolean): void {
const $$ = this;
const {api, config, $el: {tooltip}} = $$;
if (tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
const selectedData = JSON.parse(tooltip.datum().current);

I guess we can just null-check tooltip in here to avoid the error?

@elielr01 elielr01 changed the title Tooltip show false throwing error Tooltip show false throws an error Oct 10, 2020
@netil netil added the bug label Oct 12, 2020
@netil
Copy link
Member

netil commented Oct 12, 2020

Hi @elielr01, thanks for the report. I'll check the issue.

netil added a commit to netil/billboard.js that referenced this issue Oct 12, 2020
Add condition to execute related code only when tooltip
element exists.

Ref naver#1715
@netil netil closed this as completed in 5164346 Oct 12, 2020
netil pushed a commit that referenced this issue Oct 12, 2020
## [2.1.2](2.1.1...2.1.2) (2020-10-12)

### Bug Fixes

* **api:** fix resizing event element ([6c12241](6c12241)), closes [#1695](#1695)
* **tooltip:** fix error throwing for tootip.show=false ([5164346](5164346)), closes [#1715](#1715)
* **zoom:** fix to work on point.focus.only ([af1dbd7](af1dbd7)), closes [#1703](#1703)
@netil netil added the released label Oct 12, 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