javascript - How to add data labels to a Google Chart -
javascript - How to add data labels to a Google Chart -
i've created pie chart using google chart api unable command info labels added. i'd able add together label each piece of pie. can provide insight on how go doing this?
code chart below:
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setonloadcallback(drawchart); function drawchart() { var info = google.visualization.arraytodatatable([ ['resource', 'percentage'], ['video', 517], ['download', 13], ['tool', 13], ['video , download', 15], ['video , tool', 59], ['download video , tool', 5] ]); var options = { title: '', is3d: 'true', colors: ['592c81', '799a3d', '863375', '5b5b5b', '004a97', 'b8babd' ] }; var chart = new google.visualization.piechart(document.getelementbyid('piechart_3d')); chart.draw(data, options); } </script> </head> <body> <div id="piechart_3d" style="width: 900px; height: 500px;"></div>
since there's not plenty room in each slice, looks best can add
legend: { position: 'labeled' }
to options.
example here.
javascript charts google-visualization
Comments
Post a Comment