Numeric X axis for linechart

If you wanted, you could use the 'scatter' chart type (which was relatively recently introduced), or just override the default X-axis type to make it 'linear' instead of the default 'category' setting ('time' and 'logarithmic' are other options).

However, if you take this approach, you will need to change your data format:

var data = {
    // No more "labels" field!
    datasets: [{
        label: "My First dataset",
        fillColor: "rgba(220,220,220,0.5)",
        strokeColor: "rgba(220,220,220,0.8)",
        highlightFill: "rgba(220,220,220,0.75)",
        highlightStroke: "rgba(220,220,220,1)",

        data: [{x:1,y:10},{x:2,y:20},{x:4,y:30},{x:8,y:40}] // Note the structure change here!
    }]
}

You will also need to make sure (if you continue using 'line' as the chart type) that you override the options:

var options = {
    scales: {
        xAxes: [{
            type: 'linear',
            // ...
        }]
    }
}

There may be more steps required than are shown in this answer (I haven't mocked this up and I don't know your existing options), but these are the main steps.


if you want to update a array use in js :

var aChartDataMoy       = [];
for (i = 0; i < nbTamis; i++) {
            aChartDataMoy.push({
                'x': parseFloat(aTamis[i]),
                'y': parseFloat(aMoyenne[i])
            });   
}

and

datasets: [{
                    label: "Moyenne",
                    borderColor: 'rgb(229, 57, 53)',
                    borderWidth: 1,
                    fill: false,
                    data: aChartDataMoy
                }

Check out the Scatter chart extension (http://dima117.github.io/Chart.Scatter/) - listed under Community Extensions at http://www.chartjs.org/docs/#advanced-usage-community-extensions.

This supports number scales.