Chartjs-Why don't my datasets show up on line graph using Chart.js?

1👍

The documentation is not very clear on this point, but for graphing non-numerical data (such as your case where the X axis represents a Date) you cannot set the X axis to have a linear scale. In other words, if you set your axis with a linear scale, it will graph the numerical representation of the data (and therefore, not the label).

I removed type: 'linear' from your downloadsChartOptions and it solved the issue.:

var downloadsChartOptions = {
    title: {
        display: true,
        text: 'Downloads on Google Play and App Store',
        fontSize: 30
    },
    scales: {
        xAxes: [{
            scaleLabel: {
                display: true,
                labelString: 'Date',
                fontSize: 20
            },
            //type: 'linear',
            position: 'bottom',
            gridLines: {
                display: false
            }
        }],
        yAxes: [{
            scaleLabel: {
                display: true,
                labelString: 'Downloads',
                fontSize: 20
            }
        }]
    }
};

Leave a comment