Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

v2: support getElementAtEvent and getElementsAtEvent #120

Open
ledsun opened this issue Jun 16, 2016 · 1 comment
Open

v2: support getElementAtEvent and getElementsAtEvent #120

ledsun opened this issue Jun 16, 2016 · 1 comment

Comments

@ledsun
Copy link

ledsun commented Jun 16, 2016

I want to get elements by click events.

I can get elements:

const App = React.createClass({
  handleClick(e) {
    const chart = this.Bar.getChart()
    chart.getElementAtEvent(e)
  },
  render() {
    return (<Bar data={chartData} options={chartOption} onClick={this.handleClick} ref={(ref) => this.Bar = ref}/>)
  }
})

But I want like getBarsAtEvent at v1:

const App = React.createClass({
  handleClick(e) {
    const chart = this.Bar.getElementAtEvent(e)
  },
  render() {
    return (<Bar data={chartData} options={chartOption} onClick={this.handleClick} ref={(ref) => this.Bar = ref}/>)
  }
})

Please refer the Prototype Methods section in the Chart.js document.

@kncs
Copy link

kncs commented Aug 11, 2016

As far as I understand your point, bar.js need to be updated to :

var vars = require('./core');

module.exports = vars.createClass('Bar', ['getElementAtEvent']);

I think that should do the job :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants