Chart.js #scale-layout test02

by Akihiko Kusanagi

HTML

<script src="https://cdn.jsdelivr.net/gh/nagix/nagix.github.io@chartjs/Chart.5880.js"></script>
<canvas id="chart1" width=400 height=200></canvas>
<canvas id="chart2" width=400 height=200></canvas>
<canvas id="chart3" width=400 height=200></canvas>

JavaScript

var ctx1 = document.getElementById('chart1').getContext('2d');
var chart1 = new Chart(ctx1, {
  type: 'line',
  data: {
    labels: [1, 2, 3],
    datasets: [{
      data: [1, 2, 3]
    }]
  },
  options: {
    responsive: false,
    scales: {
      xAxes: [{
        gridLines: {
          color: 'rgba(255, 0, 0, 0.2)'
        }
      }],
      yAxes: [{
        gridLines: {
          color: 'rgba(0, 0, 255, 0.2)'
        }
      }]
    },
    devicePixelRatio: 1,
    title: {
      display: true,
      text: 'devicePixelRatio: 1'
    },
    legend: false
  }
});
chart1.getDatasetMeta(0).data[1].custom = {borderColor: 'red'};
chart1.getDatasetMeta(0).data[1].custom = {backgroundColor: 'red'};
chart1.update();

var ctx2 = document.getElementById('chart2').getContext('2d');
var chart2 = new Chart(ctx2, {
  type: 'line',
  data: {
    labels: [1, 2, 3],
    datasets: [{
      data: [1, 2, 3]
    }]
  },
  options: {
    responsive: false,
    scales: {
      xAxes: [{
        gridLines: {
            color: 'rgba(255, 0, 0, 0.2)',
            lineWidth: [5, 10, 15]
        }
      }],
      yAxes: [{
        gridLines: {
            color: 'rgba(0, 0, 255, 0.2)',
            lineWidth: [15, 12, 9, 6, 3]
        }
      }]
    },
    title: {
      display: true,
      text: 'Grid line array'
    },
    legend: false
  }
});
var ctx3 = document.getElementById('chart3').getContext('2d');
var chart3 = new Chart(ctx3, {
  type: 'line',
  data: {
    labels: [1, 2, 3],
    datasets: [{
      data: [1, 2, 3]
    }]
  },
  options: {
    responsive: false,
    scales: {
      xAxes: [{
        gridLines: {
          color: 'rgba(255, 0, 0, 0.2)',
          lineWidth: [5, 10, 15],
          drawOnChartArea: false
        }
      }],
      yAxes: [{
        gridLines: {
          color: 'rgba(0, 0, 255, 0.2)',
          lineWidth: [15, 12, 9, 6, 3],
          drawOnChartArea: false
        }
      }]
    },
    title: {
      display: true,
      text: 'Grid lines are...