๐:0
pretty simple, just follow their example, here
by default, the google load statement will wait for the page to load
so you can use the promise returned by google.charts.load
in place of window.onload
google.charts.load('current', {
packages: ['corechart']
}).then(function () {
var LADA_result = parseFloat(sessionStorage.getItem("LADA_Result")).toFixed( 2 );
var SAID_result = parseFloat(sessionStorage.getItem("SAID_Result")).toFixed( 2 );
var SIDD_result = parseFloat(sessionStorage.getItem("SIDD_Result")).toFixed( 2 );
var SIRD_result = parseFloat(sessionStorage.getItem("SIRD_Result")).toFixed( 2 );
var MOD_result = parseFloat(sessionStorage.getItem("MOD_Result")).toFixed( 2 );
var MARD_result = parseFloat(sessionStorage.getItem("MARD_Result")).toFixed( 2 );
var data = google.visualization.arrayToDataTable([
['Category', 'Value'],
['LADA', LADA_result],
['SAID', SAID_result],
['SIDD', SIDD_result],
['SIRD', SIRD_result],
['MOD', MOD_result],
['MARD', MARD_result]
]);
var chart = new google.visualization.PieChart(document.getElementById('chart'));
chart.draw(data);
});