Skip to content

Instantly share code, notes, and snippets.

@rakannimer
Last active September 27, 2019 12:53
Show Gist options
  • Save rakannimer/209f6cff11306bc923699031cbf01e14 to your computer and use it in GitHub Desktop.
Save rakannimer/209f6cff11306bc923699031cbf01e14 to your computer and use it in GitHub Desktop.
import React from 'react'
import {render} from 'react-dom'
import {Chart} from 'react-google-charts'
class App extends React.Component{
constructor(props) {
super(props);
}
onSelectEvent(Chart) {
console.log(Chart.chart.getSelection());
}
componentWillMount() {
this.chartEvents = [
{
eventName : 'select',
callback : (Chart) => {
this.onSelectEvent(Chart)
}
}
];
}
render() {
return (
<div className={"my-pretty-chart-container"}>
<Chart chartType = "ScatterChart" data = {[ ['Age', 'Weight'], [ 8, 12], [ 4, 5.5]]} options = {{}} graph_id = "ScatterChart" width={"100%"} height={"400px"} chartEvents={this.chartEvents}/>
</div>
)
}
}
render(<App/>, document.querySelector('#app'));
@stelarfox
Copy link

DOES NOT WORK Chart.chart is undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment