Chart JS Fill Between two lines

后端 未结 3 673
梦毁少年i
梦毁少年i 2020-12-08 23:39

I am looking for a way to fill between two lines with Chart.js so that it would look like this. I have looked and everything seems to talk about filling between two lines ac

3条回答
  •  借酒劲吻你
    2020-12-09 00:18

    Setting fill property to +1 of a dataset will set the backgroundColor from this line to the next line in dataset.

    datasets: [{
            label: 'Systolic Guideline',
            data: [],
            fill: '+1',
            borderColor: '#FFC108',
            backgroundColor: 'rgba(255,193,8,0.2)'
          },
          {
            label: 'Diastolic Guideline',
            data: [],
            fill: true,
            borderColor: '#FFC108',
            backgroundColor: 'rgba(0,0,0,0)'
          }]
    

提交回复
热议问题