google-charts
google-charts copied to clipboard
ERROR TypeError: Cannot read property 'visualization' of undefined
+1
+1
Same problem here.
can anyone provide a repository or gist with this issue in it?
+1
https://gist.github.com/anoblet/b0a0d5d4c608d8c52c64e20dd9bd8bbd
It has to do with google-charts not having any typings.
+1
+1: I've run
npm i -D google-charts
and trying this example:
import {GoogleCharts} from 'google-charts';
//Load the charts library with a callback
GoogleCharts.load(drawChart);
function drawChart() {
// Standard google charts functionality is available as GoogleCharts.api after load
const data = GoogleCharts.api.visualization.arrayToDataTable([
['Chart thing', 'Chart amount'],
['Lorem ipsum', 60],
['Dolor sit', 22],
['Sit amet', 18]
]);
const pie_1_chart = new GoogleCharts.api.visualization.PieChart(document.getElementById('chart1'));
pie_1_chart.draw(data);
}
It throws: Uncaught TypeError: Cannot read property 'visualization' of undefined