Above is a graph I made using ChartJS. I have two datasets. I also have the space between the two datasets filled just like I want it. But I need to get two different colors for the fill. When the Hours dataset is bigger than the Goal dataset, I want the fill to be green, and when the Hours dataset is smaller than Goal, I want it to be red. I'm really hoping there is a way to do this using ChartJS, so that I don't have to recreate this in Canvas.
If it matters, this is in Vue.Js.
Here is the code for the two datasets:
const dataSets = [{
label: this.dataSetLabel,
data: this.dataArray,
backgroundColor: new Array(this.dataArray.length).fill('rgba(255, 0, 0, 0.8)'), // red
borderColor: new Array(this.dataArray.length).fill('rgba(255, 0, 0, 0.8)'),
borderWidth: 1,
fill: '+1'
}]
if (this.fi !== 3) {
dataSets.push({
label: 'Goal',
data: new Array(this.dataArray.length).fill(this.user.braceHours),
type: 'line',
backgroundColor: new Array(this.dataArray.length).fill('rgba(84, 232, 198, 0.8)'), // green
borderColor: new Array(this.dataArray.length).fill('rgba(84, 232, 198, 0.8)'),
borderWidth: 1,
fill: '-1'
})
}
Any help with this would be much appreciated.