1new Chart(document.getElementById("mixed-chart"), {
2 type: 'bar',
3 data: {
4 labels: ["1900", "1950", "1999", "2050"],
5 datasets: [{
6 label: "Europe",
7 type: "line",
8 borderColor: "#8e5ea2",
9 data: [408,547,675,734],
10 fill: false
11 }, {
12 label: "Africa",
13 type: "line",
14 borderColor: "#3e95cd",
15 data: [133,221,783,2478],
16 fill: false
17 }, {
18 label: "Europe",
19 type: "bar",
20 backgroundColor: "rgba(0,0,0,0.2)",
21 data: [408,547,675,734],
22 }, {
23 label: "Africa",
24 type: "bar",
25 backgroundColor: "rgba(0,0,0,0.2)",
26 backgroundColorHover: "#3e95cd",
27 data: [133,221,783,2478]
28 }
29 ]
30 },
31 options: {
32 title: {
33 display: true,
34 text: 'Population growth (millions): Europe & Africa'
35 },
36 legend: { display: false }
37 }
38});
39
1// Bar chart
2new Chart(document.getElementById("bar-chart"), {
3 type: 'bar',
4 data: {
5 labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
6 datasets: [
7 {
8 label: "Population (millions)",
9 backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
10 data: [2478,5267,734,784,433]
11 }
12 ]
13 },
14 options: {
15 legend: { display: false },
16 title: {
17 display: true,
18 text: 'Predicted world population (millions) in 2050'
19 }
20 }
21});
22