chart JS

by Dmitri Ganenco

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
<canvas id='canvas' height='300' width='300'></canvas>

JavaScript

new Chart(document.getElementById("canvas"), {
    type: 'pie',
    data: {
      labels: ["Africa", "Asia", "Europe"],
      datasets: [{
        label: "Population (millions)",
        backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f"],
        data: [2478,5267,734]
      }]
    },
    options: {
    responsive: false,
      title: {
        display: true,
        text: 'Predicted world population (millions) in 2050'
      },
      legend: {
        position: 'bottom',
        labels: {
	        boxWidth: 10,
        }
      }
    }
});