score:1

Accepted answer

the issue is merely occurring due to the fact that, you have placed the options object/property, inside the data property, while it should be outside.

here is the revised version of your code :

var ctx = document.getelementbyid("chart_canvas").getcontext('2d')

var basic_line = new chart(ctx, {
   type: 'line',
   data: {
      labels: data.labels,
      datasets: [{
         label: 'price',
         yaxisid: 'b',
         fill: false,
         bordercolor: ["#668cff"],
         data: data.price
      }, {
         label: 'sales',
         yaxisid: 'a',
         fill: false,
         bordercolor: ["grey"],
         data: data.sales
      }]
   },
   options: {
      scales: {
         yaxes: [{
            id: 'a',
            position: 'left',
            type: 'linear'
         }, {
            id: 'b',
            position: 'right',
            type: 'linear'
         }]
      },
      responsive: true,
      maintainaspectratio: false
   }
});

Related Query

More Query from same tag