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

wrong type of parameter 'id' of LegendOptions.item.onclick #2203

Closed
bb-in-hoodie opened this issue Jul 20, 2021 · 1 comment
Closed

wrong type of parameter 'id' of LegendOptions.item.onclick #2203

bb-in-hoodie opened this issue Jul 20, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@bb-in-hoodie
Copy link

Description

image
tested using the example code in Legend Template1 example

even though the parameter id of LegendOptions.item.onclick is defined as DataItem type, it actually is a string type value which shows the id of a selected legend item.


image
options.d.ts > LegendOptions > item

onclick, onover, onout share the same parameter type.


Steps to check or reproduce

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

// for ESM environment, need to import modules as:
// import bb, {pie} from "billboard.js"

var chart = bb.generate({
  data: {
    columns: [['data1', 100], ['data2', 300], ['data3', 200]],
    type: 'pie' // for ESM specify as: pie()
  },
  legend: {
    contents: {
      bindto: '#legend',
      template:
        "<span style='color:#fff;padding:10px;background-color:{=COLOR}'>{=TITLE}</span>"
    },
    item: {
      onclick: id => console.log(id)
    }
  },
  bindto: '#legendTemplate1'
});
@bb-in-hoodie bb-in-hoodie changed the title wrong type of a parameter 'id' of LegendOptions.item.onclick wrong type of parameter 'id' of LegendOptions.item.onclick Jul 20, 2021
@netil netil added the bug label Jul 21, 2021
@netil
Copy link
Member

netil commented Jul 21, 2021

Hi @bb-in-hoodie, thanks for the report. Will be fixed soon.

@netil netil closed this as completed in 630992d Jul 21, 2021
netil added a commit that referenced this issue Jul 22, 2021
Fix legend.item.onclick, onover and onout argument types.

Fix #2203
@netil netil added this to the Patch milestone Jul 27, 2021
@netil netil self-assigned this Jul 27, 2021
github-actions bot pushed a commit that referenced this issue Jul 28, 2021
## [3.1.3](3.1.2...3.1.3) (2021-07-28)

### Bug Fixes

* **api:** fix subchart APIs usage with zoom reset button ([982f6ee](982f6ee)), closes [#2201](#2201)
* **axis:** fix bar type tick.fit=false throwing error ([083f5c7](083f5c7)), closes [#2210](#2210)
* **axis:** fix handling x axis localtime ([1d2ce8f](1d2ce8f)), closes [#2186](#2186)
* **Axis:** fix transition on flow ([a656fe5](a656fe5)), closes [#2189](#2189)
* **shape:** fix incorrect shape offset ([d2be8c0](d2be8c0)), closes [#2187](#2187)
* **types:** fix wrong legend.item callbacks args types ([1196bbf](1196bbf)), closes [#2203](#2203)
* **zoom:** fix inconsistent zoom on .zoom() -> wheel ([4eee2d8](4eee2d8)), closes [#2194](#2194)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants