Chartjs-Chartjs โ€“ how do I add border radius on bottom corners

1๐Ÿ‘

โœ…

You can simply use border-radius on the canvas element to achieve this:

new Chart(document.getElementById("chart"), {
  type: "line",
  data: {
    labels: ["", "", "", "", ""],
    datasets: [{
      data: [1, 2, 1, 2, 1]
    }]
  },
  options: {
    scales: {
      xAxes: [{
        display: false
      }],
      yAxes: [{
        display: false,
        ticks: {
          beginAtZero: true
        }
      }]
    }
  }
});
canvas {
  border-bottom-left-radius: 3em;
  border-bottom-right-radius: 3em;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<canvas id="chart"></canvas>

Leave a comment