Thursday, November 24, 2016

How to easily get a pie chart in blogger

Okay, who would've known that getting a pie chart into blogger (or any website or blog) was so easy...



Yup, just put the following code into the HTML section of blogger and you are good to go. Of course, you can modify the ethnicities and percentages to match you.

<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js"></script>
   <br />
<div id="myDiv" style="height: 380px; width: 480px;">
<!-- Plotly chart will be drawn inside this DIV --></div>
<script type="text/javascript">
    var data = [{
    values: [63, 13, 7, 4, 2, 6, 4, 1],
    labels: ['Italy/Greece', 'Europe West', 'Great Britian', 'Ireland', 'Iberian Peninsula', 'Caucasus', 'Middle East', 'Africa North'],
           type: 'pie'
    }];
   var layout = {
   height: 400,
   width: 500
  };
  Plotly.newPlot('myDiv', data, layout);
</script>



No comments:

Post a Comment

Landing Spicoli in the Wind

Many know by now that I have three Blade 200 S RC helicopters in my fleet: Speck - for training Spot - for maintenance exercises Spicol...