Google charts
-
Hello,
Is there way to use google charts? I tried this but its not working, i can't pass data to functionScript
google.charts.load('current', {'packages':['corechart']}); function graph(element, data){ google.charts.setOnLoadCallback( function() { drawPieChart(element, data); }); } function drawPieChart(element,rdata) { console.log('Draw chart') var data = google.visualization.arrayToDataTable(rdata); var options = { pieHole: 0.5, pieSliceTextStyle: { color: 'black', }, legend: 'none' }; var chart = new google.visualization.PieChart(document.getElementById(element)); chart.draw(data, options); }
Template
<body> <script> graph('returnRate',{{returnRateGraphData}} ); </script> <div id="returnRate" style="width: 900px; height: 500px;"></div> </body>
-
hi! can you please reproduce your example in the playground, save it and then share the link back here? it will help to check the full example, maybe there is something missing here and we can help pointing where should be the fix in your code
-
https://playground.jsreport.net/w/anon/hhVAb~Jm
if you leave the graph2 function commented, it will work, but i need somehow pass data.
-
@Arcus16 using DOM dataset attribut I did manage to pass data to your chart see this playground, hope this can help
-
@MI53RE19 Thank You!
-
@bjrmatos or @MI53RE19 can i pass an array in some data that i recieved in function "graphs"?
i been try with a handlebars but graph does not showing