score:3

Accepted answer

yes this is possible, you can achieve this in 2 ways, 1 is to specify each datapoint using its x and y coordinate another one is to place some null values in the start of your data array:

var options = {
  type: 'line',
  data: {
    labels: [1, 2, 3, 4, 5, 6],
    datasets: [{
        label: '# of votes',
        data: [12, 19, 3, 5, 2, 3],
        bordercolor: 'pink'
      },
      {
        label: '# of points',
        data: [{
          x: 3,
          y: 6
        }, {
          x: 4,
          y: 8
        }, {
          x: 5,
          y: 2
        }, {
          x: 6,
          y: 12
        }],
        bordercolor: 'orange'
      },
      {
        label: '# of points2',
        data: [null, null, null, 9, 13, 15],
        bordercolor: 'lightblue'
      }
    ]
  },
  options: {
    scales: {
      yaxes: [{
        ticks: {
          reverse: 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.5.0/chart.js"></script>
</body>


Related Query

More Query from same tag