diff --git a/BollingerBandsPanel.js b/BollingerBandsPanel.js index a6c50a880..cf23bada6 100644 --- a/BollingerBandsPanel.js +++ b/BollingerBandsPanel.js @@ -197,55 +197,16 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () { browserCanvasContext.lineWidth = 0.2; browserCanvasContext.stroke(); - - browserCanvasContext.beginPath(); - /* put the labels with the bands values */ - - - let y; - printLabel('Moving Average', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '1'); - printLabel(currentBand.innerBand.movingAverage, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '0.50'); + printLabel('Moving Average', X_AXIS, frameTitleHeight + frameBodyHeight * 0.05, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentBand.innerBand.movingAverage, X_AXIS, frameTitleHeight + frameBodyHeight * 0.10, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); - printLabel('Deviation', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '1'); - printLabel(currentBand.innerBand.deviation, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '0.50'); - - function printLabel(labelToPrint, x, y, opacity) { - - let labelPoint; - let fontSize = 10; - - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira'; - - let label = labelToPrint - if (isNaN(label) === false) { - label = dynamicDecimals(labelToPrint) - label = label.toLocaleString(); - } - let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO; - - labelPoint = { - x: x - xOffset, - y: y - }; - - labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); - - labelPoint = thisObject.fitFunction(labelPoint) - - browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')'; - browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); - - } - - browserCanvasContext.closePath(); - browserCanvasContext.fill(); + printLabel('Deviation', X_AXIS, frameTitleHeight + frameBodyHeight * 0.95, '0.60', undefined, undefined, true, thisObject.container, thisObject.fitFunction); + printLabel(currentBand.innerBand.deviation, X_AXIS, frameTitleHeight + frameBodyHeight * 0.90, '1.00', 15, undefined, true, thisObject.container, thisObject.fitFunction); } - - }