Chartjs-Iterating through the same dataset in Chart.js

0👍

You can write a function for it:

... 
{
  label: 'Line Dataset',
  data: getLineData(50, 4),
  // Changes this dataset to become a line
  type: 'line'
}
... // end of chart options

function getLineData(value, times) {
  var data = []

  for(var i=0; i < times; i++) {
    data.push(value)
  }

  return data
}

Leave a comment