<script src='https://www.gstatic.com/charts/loader.js'></script> was added in the page head.
xxxxxxxxxx
%%html
<div id='test_googlechart3' style='width:610px; height:410px;'/>
<script>
google.charts.load('current',{packages:['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data=google.visualization.arrayToDataTable([
['Element','Density',{role:'style'}],
['Copper',8.94,'color:#b87333; fill-opacity:'+
Math.random()+'; stroke-width:4;'],
['Silver',10.49,'color:silver; fill-opacity:'+
Math.random()+'; stroke-width:5;'],
['Gold',19.30,'color:gold; fill-opacity:'+
Math.random()+'; stroke-width:6;'],
['Platinum',21.45,'color:#e5e4e2; fill-opacity:'+
Math.random()+'; stroke-width:7;']]);
var view=new google.visualization.DataView(data);
view.setColumns([0,1,{calc:'stringify',sourceColumn:1,
type:'string',role:'annotation'},2]);
var options={title:'Density of Precious Metals, in g/cm^3',
width:580,height:400,bar:{groupWidth:'80%'},
legend:{position:'none'},background:{color:'black'}};
var doc=document.getElementById('test_googlechart3');
var chart=new google.visualization.ColumnChart(doc);
chart.draw(data,options);};
No comments:
Post a Comment