From 1f9ce2648533c18a4d25bea420ba196c0d296ab3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 25 Feb 2019 21:17:34 +0100 Subject: [PATCH] Text overlapping problem solved --- TradingSimulation.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/TradingSimulation.js b/TradingSimulation.js index a168ccd7c..99ff34689 100644 --- a/TradingSimulation.js +++ b/TradingSimulation.js @@ -519,6 +519,7 @@ if (INTENSIVE_LOG === true) { logger.write("[INFO] plotChart -> Entering function."); } let record; + lastImage = 0; if (records.length > 0) { @@ -660,6 +661,16 @@ if (record.type !== '' || record.signal !== '') { + let noText = false; + + if (lastImage < 5) { + noText = true; // we avoid image texts to overlap. + } else { + noText = false; + lastImage = 0; + } + + /* Next we are drawing the stick */ browserCanvasContext.beginPath(); @@ -764,8 +775,10 @@ ) { // we do not write any text } else { - printLabel(line1, recordPoint2.x + imageSize / 2 + 5, recordPoint2.y + 0, '0.50'); - printLabel(line2, recordPoint2.x + imageSize / 2 + 5, recordPoint2.y + 15, '0.50'); + if (noText === false) { + printLabel(line1, recordPoint2.x + imageSize / 2 + 5, recordPoint2.y + 0, '0.50'); + printLabel(line2, recordPoint2.x + imageSize / 2 + 5, recordPoint2.y + 15, '0.50'); + } } @@ -786,6 +799,8 @@ } + } else { + lastImage++; } } }