Chartjs-Plot Chart.js scatter graph in Django using huge data

0👍

According to the documentation for Chart.js the scatter chart accepts data as an array with {x: ..., y: ...} pairs.

To reshape the two arrays volume and count into that shape, you’d do

const data = count.map((x, index) => ({x, y: volume[index]}));

assuming they’re the same length.

Leave a comment