diff --git a/frontend/frontend.js b/frontend/frontend.js index 44fe0e7..57b5ee3 100644 --- a/frontend/frontend.js +++ b/frontend/frontend.js @@ -26,15 +26,20 @@ function fillTable (obj, dom) { } } -function graphSpectralData(obj, dom) { +function graphSpectralData (obj, dom) { // graphs the data from obj[0] into canvas at dom + var arr; + for (var i in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L']) { + arr.push(obj[i]); + } + var chart = new Chart(dom, { type: 'line', data: { - labels: Object.keys(obj[0]), + labels: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L'], datasets: [{ label: 'Spectrometer data', - data: Object.values(obj[0]) + data: arr }] }, options: {