[Chartjs]-Draw two plots using chartjs over one another with transparency

17👍

You need to set fill property to false for the first dataset (the red one), to make it transparent.

datasets: [{
         label: "Consumption",
         fill: false,
         pointRadius: 0,
         borderColor: "#0000ff",
         backgroundColor: "rgba(255,10,13,255)",
         ...

or, you can also reduce the opacity of background color, like so …

backgroundColor: "rgba(255, 10, 13, 0.1)"

Here is the working codepen

Leave a comment