Chartjs-How can I make my backgroundColor in Chart.js match up with a reversed order y axis?

1👍

Just try to add fill: ‘start’.

Check


    var options = {
      type: 'line',
      data: {
      labels: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
      datasets: [
            {
              label: 'Rank',
              data: [12, 19, 3, 5, 2, 3],
              borderWidth: 1,
              backgroundColor: "#8FBC8F",
              fill: 'start'
            }
            ]
      },
      options: {
        scales: {
            yAxes: [{
            ticks: {
                        reverse: true
            }
          }]
        }
      }
    }

    var ctx = document.getElementById('chartJSContainer').getContext('2d');
    new Chart(ctx, options);

Leave a comment