Chartjs-Using chart.js for isotopic patterns

0👍

You can make the scale a linear scale and just provide the x and y as coordinates.

var options = {
  type: 'bar',
  data: {
    datasets: [{
      label: 'Nice label',
      data: [{
        x: 10,
        y: 5
      }, {
        x: 13,
        y: 3
      }, {
        x: 20,
        y: 8
      }, {
        x: 22,
        y: 15
      }],
      backgroundColor: 'pink'
    }]
  },
  options: {
    scales: {
      x: {
        type: 'linear',
        ticks: {
          maxTicksLimit: 4
        },
        grid: {
          display: false
        }
      },
      y: {
        grid: {
          display: false
        }
      }
    }
  }
}

var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.js"></script>
</body>

Leave a comment