From 9d9a192d8b7797d8fe9fba66b6d88d47d839c425 Mon Sep 17 00:00:00 2001 From: Kristjan Komlosi Date: Sat, 2 Nov 2019 12:12:36 +0100 Subject: [PATCH] named ticks --- frontend/frontend.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/frontend.js b/frontend/frontend.js index e42b100..9573e65 100644 --- a/frontend/frontend.js +++ b/frontend/frontend.js @@ -20,21 +20,17 @@ function updateData () { function graphSpectralData (obj, dom) { // graph spectral data in obj into dom var graphPoints = []; + var graphXTicks = []; + Object.keys(obj).forEach((element, index) => { graphPoints.push([index, obj[element]]); + graphXTicks.push([index, element]); }); + console.log(graphPoints); const options = { - color: 'white', - grid: { - color: 'white' - }, - xaxis: { - color: 'green' - }, - yaxis: { - color: 'blue' - } + grid: {color: 'white'}, + xaxis: {ticks: graphXTicks} }; $.plot('#graph', [graphPoints], options); // flot expects an array of arrays (lines) of 2-element arrays (points)