Accepted answer

considering you have two arrays (marketing and amount) as such :

var marketing = ['2017-08-05', '2017-08-12'];
var amount = [50, 70];

you can create/populate the annotations array dynamically based on one of those arrays (marketing/amount) to draw multiple vertical lines, like so :

// populate 'annotations' array dynamically based on 'marketing'
var annotations =, index) {
   return {
      type: 'line',
      id: 'vline' + index,
      mode: 'vertical',
      scaleid: 'x-axis-0',
      value: date,
      bordercolor: 'green',
      borderwidth: 1,
      label: {
         enabled: true,
         position: "center",
         content: amount[index]

see a working example.

Related Query

More Query from same tag