I have created a small react program to display a scatter google chart. I have 3 files in total :- a) index.html b)main.js which renders my scatterChart & c) ScatterChart.js which is a react component which my main.js renders ScatterChart.js looks like :
export default class PieChart extends React.Component {
constructor(){
super();
var myOptions = {
title: 'Age vs. Weight comparison',
hAxis: {title: 'Age', minValue: 0, maxValue: 15},
vAxis: {title: 'Weight', minValue: 0, maxValue: 15},
legend: 'none'
};
var myData = [
['Age', 'Weight'],
[ 8, 12],
[ 4, 5.5],
[ 11, 14],
[ 4, 5],
[ 3, 3.5],
[ 6.5, 7]
];
this.state={
data : myData,
options : myOptions
};
}
render() {
return(
<Chart chartType = "ScatterChart" data = {this.state.data} options = {this.state.options} graph_id = "ScatterChart" width={"100%"} height={"400px"} legend_toggle={true} />
);
}}
this returns me the following error :
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of ScatterChart.