Chart.js #9083

by Akihiko Kusanagi

HTML

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.js"></script>
<div>
  <canvas id="myChart" width="512" height="256"></canvas>
</div>

JavaScript

var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
  type: 'line',
  data: {
    datasets: [{
      data: [{
        x: 10,
        y: 1
      }, {
        x: 0,
        y: 5
      }, {
        x: -10,
        y: 15
      }, {
        x: -5,
        y: 19
      }],
      borderColor: 'red',
      cubicInterpolationMode: 'monotone'
    }]
  },
  options: {
    indexAxis: 'y',
    scales: {
      x: {
        min: -15,
        max: 15
      },
      y: {
        type: 'linear',
        min: 0,
        max: 20
      }
    },
    animation:false,
    plugins: {
      legend: false
    }
  }
});