From d68a82812e5759341e73a489a6af234e48778573 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Mar 2020 13:44:08 +0100 Subject: [PATCH] rate scale improved --- CanvasApp/Scales/RateScale.js | 12 +++++++++++- .../plotters/Plotters-Candles-Volumes/Candles.js | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CanvasApp/Scales/RateScale.js b/CanvasApp/Scales/RateScale.js index 4fafa81f9..e94a56a6f 100644 --- a/CanvasApp/Scales/RateScale.js +++ b/CanvasApp/Scales/RateScale.js @@ -445,13 +445,23 @@ function newRateScale () { rate = coordinateSystem.max.y } - let label = (rate - Math.trunc(rate)).toFixed(2) + let decimals = 2 + if (rate < 1) { decimals = 4 } + if (Math.trunc(rate * 100) < 1) { decimals = 6 } + if (Math.trunc(rate * 10000) < 1) { decimals = 8 } + if (Math.trunc(rate * 1000000) < 1) { decimals = 10 } + let label = (rate - Math.trunc(rate)).toFixed(decimals) let labelArray = label.split('.') let label1 = thisObject.payload.node.payload.parentNode.name let label2 = (Math.trunc(rate)).toLocaleString() let label3 = labelArray[1] if (label3 === undefined) { label3 = '00' } + if (rate < 1) { + label2 = label + label3 = '' + } + let icon1 = canvas.designSpace.iconByUiObjectType.get(thisObject.payload.node.payload.parentNode.type) let icon2 = canvas.designSpace.iconByUiObjectType.get(thisObject.payload.node.type) diff --git a/Legacy-Code/Masters/plotters/Plotters-Candles-Volumes/Candles.js b/Legacy-Code/Masters/plotters/Plotters-Candles-Volumes/Candles.js index 73963ce56..0f9eea85d 100644 --- a/Legacy-Code/Masters/plotters/Plotters-Candles-Volumes/Candles.js +++ b/Legacy-Code/Masters/plotters/Plotters-Candles-Volumes/Candles.js @@ -602,6 +602,9 @@ candle = candles[i]; + /* Skip the first candle with zero at open */ + if (candle.open === 0) { continue } + if (candle.candlePoint2.x < canvas.chartingSpace.viewport.visibleArea.bottomLeft.x || candle.candlePoint1.x > canvas.chartingSpace.viewport.visibleArea.bottomRight.x) { continue }