score:0

yes, it's possible

you can check my fiddle: https://jsfiddle.net/iphong993/gru4lad6/14/

var canvas = document.getelementbyid('chart');
new chart(canvas, {
  type: 'line',
  data: {
    labels: ['1', '2', '3', '4', '5'],
    datasets: [{
      label: 'a',
      yaxisid: 'a',
      data: [100, 96, 84, 76, 69]
    }]
  },
  options: {
    scales: {
      yaxes: [{
        id: 'a',
        type: 'linear',
        position: 'left',
      }, {
        id: 'b',
        type: 'linear',
        position: 'right',
        ticks: {
          max: 1,
          min: 0
        }
      }]
    },
    annotation: {
        annotations: [          
          {
            drawtime: "beforedatasetsdraw",
            type: "box",
            xscaleid: "x-axis-0",
            yscaleid: "b",
            xmin: "3",
            xmax: "5",
            ymin: 0.3,
            ymax: 0.3,            
            bordercolor: "red",
            borderwidth: 1,
            onclick: function(e) {
              console.log("box", e.type, this);
            }            
          },
          {
            drawtime: "beforedatasetsdraw",
            type: "box",
            xscaleid: "x-axis-0",
            yscaleid: "b",
            xmin: "3",
            xmax: "3",
            ymin: 0,
            ymax: 0.3,            
            bordercolor: "red",
            borderwidth: 1,
            onclick: function(e) {
              console.log("box", e.type, this);
            }            
          }
        ]
      }
  }
});

Related Query

More Query from same tag