pie chart - Google Piechart -
i try create pie chart on website, found example code
<div id="piechart"></div> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // load google charts google.charts.load('current', {'packages':['corechart']}); google.charts.setonloadcallback(drawchart); // draw chart , set chart values function drawchart() { var data = google.visualization.arraytodatatable([ ['task', 'hours per day'], ['work', 8], ['eat', 2], ['tv', 4], ['gym', 2], ['sleep', 8] ]); // optional; add title , set width , height of chart var options = {'title':'my average day', 'width':550, 'height':400}; // display chart inside <div> element id="piechart" var chart = new google.visualization.piechart(document.getelementbyid('piechart')); chart.draw(data, options); } </script>
(https://www.w3schools.com/howto/tryit.asp?filename=tryhow_google_pie_chart)
but error message :
table has no columns.
can me pls?
thanks
unfortunatelly cannot comment.
this code works - fiddle. give more details project?
sample of code fiddle
<div id="piechart"></div>
edit:
table has no columns.
is error message browser console?
Comments
Post a Comment