score:1

Accepted answer

here is the code:

var fv201_ctx = document.getelementbyid('fv201_chart').getcontext('2d');
    var fv201_cfg = {
        type: 'line',
        data: {
          labels: fv201_timestamps,
          datasets: [
            {
              label: 'temps',
              data: fv201_temps,
              type: 'line',
              fill: false
            }
          ]
         },
          options: {
            title: {text: 'my chart', display: false},
            scales: {
                xaxes: [{
                    type: 'time',
                    time: {
                        unit: 'second',
                        displayformats: { second: 'hh:mm:ss' },
                        parser: function(foo) { return moment(foo,'x'); }
                    }
                }],
                yaxes: [{
                  ticks: {
                     suggestedmin: 28.5,
                     suggestedmax: 29,
                     stepsize: 0.1
                  }
              }]
            },
          }
    };
    var fv201_chart = new chart(fv201_ctx, fv201_cfg);
    fv201_chart.update();
  1. options should not be inside data object.
  2. x and y axes should be array types.

Related Query

More Query from same tag