From 25c005d70e1d738e468e9673f3a997151c278e78 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 14 Apr 2020 18:38:28 +0200 Subject: [PATCH] Decimals --- Panels/PlotterPanel.js | 2 +- Plotter.js | 4 ++++ Utilities.js | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 820f4702a..d180560fe 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -172,7 +172,7 @@ function newPlotterPanel () { } printLabel(labelText, X_AXIS, UI_PANEL.HEIGHT.NORMAL * labelPosition / 100 / heightFactor, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction) - printLabel(value, X_AXIS, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction) + printLabel(value, X_AXIS, UI_PANEL.HEIGHT.NORMAL * valuePosition / 100 / heightFactor, '1.00', 14, undefined, true, thisObject.container, thisObject.fitFunction, false, true) } } } diff --git a/Plotter.js b/Plotter.js index 3034b81b9..bba22925f 100644 --- a/Plotter.js +++ b/Plotter.js @@ -720,6 +720,10 @@ function newPlotter () { let polygonVertex = polygon.polygonVertexes[k] if (polygonVertex.referenceParent !== undefined) { let dataPointObject = dataPoints.get(polygonVertex.referenceParent.id) + if (dataPointObject === undefined) { + console.log('[WARN] You have a Polygon Vertex not referencing any Point.') + continue + } let dataPoint = { x: dataPointObject.x, y: dataPointObject.y diff --git a/Utilities.js b/Utilities.js index e9c85a67b..294c6ec07 100644 --- a/Utilities.js +++ b/Utilities.js @@ -244,7 +244,7 @@ function removeTime (datetime) { return dateOnly } -function printLabel (labelToPrint, x, y, opacity, fontSize, color, center, container, fitFunction, noDecimals) { +function printLabel (labelToPrint, x, y, opacity, fontSize, color, center, container, fitFunction, noDecimals, fixedDecimals) { if (labelToPrint === undefined) { return } let labelPoint if (color === undefined) { color = UI_COLOR.DARK } @@ -253,7 +253,9 @@ function printLabel (labelToPrint, x, y, opacity, fontSize, color, center, conta browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY let label = labelToPrint if (isNaN(label) === false && label !== '') { - label = dynamicDecimals(labelToPrint) + if (fixedDecimals !== true) { + label = dynamicDecimals(labelToPrint) + } label = label.toLocaleString() if (noDecimals === true) { label = Math.trunc(label)