I am trying to make a chart in Chart.js which outputs the world's population (this is just an example which I am gonna be using for a different project), my problem is that one of the countries doesn't have a population (Somethingistan), I do want the country to be listed in the position is it right now but I want to population to 'skip' it, is there any way of doing this?
This is me making my chart
new Chart(document.getElementById("bar-chart"), {
type: 'bar',
data: {
labels: ["Africa", "Asia", "Europe", "Somethingistan", "North America"],
datasets: [
{
label: "Population (millions)",
backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
data: [2478,5267,734,784,433]
}
]
},
options: {
legend: { display: false },
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
}
}
});
I have also already tried this method:
data: [{x:"Africe", y:2478},{x:"Asia", y:5267},{x:"Europa", y:734},{x:"North America", y:784}]
But I don't think it will work, but basically that is what I want to achieve, to bind data to specific labels.