Last active
September 27, 2019 12:53
-
-
Save rakannimer/209f6cff11306bc923699031cbf01e14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DOES NOT WORK Chart.chart is undefined