diff --git a/CandlePanel.js b/CandlePanel.js index a4af40149..6c013cebd 100644 --- a/CandlePanel.js +++ b/CandlePanel.js @@ -1,7 +1,7 @@  function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { - var currentCandlePanel = { + var thisObject = { onEventRaised: onEventRaised, container: undefined, draw: draw, @@ -11,22 +11,22 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { var container = newContainer(); container.initialize(); - currentCandlePanel.container = container; + thisObject.container = container; container.displacement.containerName = "Current Candle Panel"; container.frame.containerName = "Current Candle Panel"; let currentCandle; - return currentCandlePanel; + return thisObject; function initialize() { - currentCandlePanel.container.frame.width = 250; - currentCandlePanel.container.frame.height = 300; + thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - currentCandlePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentCandlePanel.container.frame.width * 2; - currentCandlePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentCandlePanel.container.frame.height; + thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 2; + thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; } @@ -71,10 +71,10 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { if (currentCandle === undefined) { return; } if (currentCandle.innerCandle === undefined) { return; } - const frameBodyHeight = currentCandlePanel.container.frame.getBodyHeight(); - const frameTitleHeight = currentCandlePanel.container.frame.height - frameBodyHeight; + const frameBodyHeight = thisObject.container.frame.getBodyHeight(); + const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; - const X_AXIS = currentCandlePanel.container.frame.width / 2; + const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS = frameTitleHeight + frameBodyHeight / 2; var candlePoint1 = { @@ -181,15 +181,15 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { } - candlePoint1 = currentCandlePanel.container.frame.frameThisPoint(candlePoint1); - candlePoint2 = currentCandlePanel.container.frame.frameThisPoint(candlePoint2); - candlePoint3 = currentCandlePanel.container.frame.frameThisPoint(candlePoint3); - candlePoint4 = currentCandlePanel.container.frame.frameThisPoint(candlePoint4); + candlePoint1 = thisObject.container.frame.frameThisPoint(candlePoint1); + candlePoint2 = thisObject.container.frame.frameThisPoint(candlePoint2); + candlePoint3 = thisObject.container.frame.frameThisPoint(candlePoint3); + candlePoint4 = thisObject.container.frame.frameThisPoint(candlePoint4); - stickPoint1 = currentCandlePanel.container.frame.frameThisPoint(stickPoint1); - stickPoint2 = currentCandlePanel.container.frame.frameThisPoint(stickPoint2); - stickPoint3 = currentCandlePanel.container.frame.frameThisPoint(stickPoint3); - stickPoint4 = currentCandlePanel.container.frame.frameThisPoint(stickPoint4); + stickPoint1 = thisObject.container.frame.frameThisPoint(stickPoint1); + stickPoint2 = thisObject.container.frame.frameThisPoint(stickPoint2); + stickPoint3 = thisObject.container.frame.frameThisPoint(stickPoint3); + stickPoint4 = thisObject.container.frame.frameThisPoint(stickPoint4); @@ -282,7 +282,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() { y: y }; - labelPoint = currentCandlePanel.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y); diff --git a/VolumePanel.js b/VolumePanel.js index 918f76f9f..0f92c7205 100644 --- a/VolumePanel.js +++ b/VolumePanel.js @@ -1,7 +1,7 @@  function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { - var currentVolumePanel = { + var thisObject = { onEventRaised: onEventRaised, container: undefined, draw: draw, @@ -11,22 +11,22 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { var container = newContainer(); container.initialize(); - currentVolumePanel.container = container; + thisObject.container = container; container.displacement.containerName = "Current Volume Panel"; container.frame.containerName = "Current Volume Panel"; let currentVolume; - return currentVolumePanel; + return thisObject; function initialize() { - currentVolumePanel.container.frame.width = 250; - currentVolumePanel.container.frame.height = 300; + thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL; + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL; - currentVolumePanel.container.frame.position.x = viewPort.visibleArea.topRight.x - currentVolumePanel.container.frame.width; - currentVolumePanel.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - currentVolumePanel.container.frame.height; + thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width; + thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height; } @@ -71,10 +71,10 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { if (currentVolume === undefined) { return; } if (currentVolume.innerVolumeBar === undefined) { return; } - const frameBodyHeight = currentVolumePanel.container.frame.getBodyHeight(); - const frameTitleHeight = currentVolumePanel.container.frame.height - frameBodyHeight; + const frameBodyHeight = thisObject.container.frame.getBodyHeight(); + const frameTitleHeight = thisObject.container.frame.height - frameBodyHeight; - const X_AXIS = currentVolumePanel.container.frame.width / 2; + const X_AXIS = thisObject.container.frame.width / 2; const Y_AXIS_BUY = frameTitleHeight + frameBodyHeight * 0.85; const Y_AXIS_SELL = frameTitleHeight + frameBodyHeight * 0.15; @@ -98,15 +98,15 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_BUY }; - buyVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint1); - buyVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint2); - buyVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint3); - buyVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(buyVolumePoint4); + buyVolumePoint1 = thisObject.container.frame.fitIntoFrame(buyVolumePoint1); + buyVolumePoint2 = thisObject.container.frame.fitIntoFrame(buyVolumePoint2); + buyVolumePoint3 = thisObject.container.frame.fitIntoFrame(buyVolumePoint3); + buyVolumePoint4 = thisObject.container.frame.fitIntoFrame(buyVolumePoint4); - buyVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint1); - buyVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint2); - buyVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint3); - buyVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(buyVolumePoint4); + buyVolumePoint1 = thisObject.container.frame.frameThisPoint(buyVolumePoint1); + buyVolumePoint2 = thisObject.container.frame.frameThisPoint(buyVolumePoint2); + buyVolumePoint3 = thisObject.container.frame.frameThisPoint(buyVolumePoint3); + buyVolumePoint4 = thisObject.container.frame.frameThisPoint(buyVolumePoint4); var sellVolumePoint1 = { x: X_AXIS - currentVolume.buyInfo.baseWidth / 2, @@ -128,15 +128,15 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: Y_AXIS_SELL }; - sellVolumePoint1 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint1); - sellVolumePoint2 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint2); - sellVolumePoint3 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint3); - sellVolumePoint4 = currentVolumePanel.container.frame.fitIntoFrame(sellVolumePoint4); + sellVolumePoint1 = thisObject.container.frame.fitIntoFrame(sellVolumePoint1); + sellVolumePoint2 = thisObject.container.frame.fitIntoFrame(sellVolumePoint2); + sellVolumePoint3 = thisObject.container.frame.fitIntoFrame(sellVolumePoint3); + sellVolumePoint4 = thisObject.container.frame.fitIntoFrame(sellVolumePoint4); - sellVolumePoint1 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint1); - sellVolumePoint2 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint2); - sellVolumePoint3 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint3); - sellVolumePoint4 = currentVolumePanel.container.frame.frameThisPoint(sellVolumePoint4); + sellVolumePoint1 = thisObject.container.frame.frameThisPoint(sellVolumePoint1); + sellVolumePoint2 = thisObject.container.frame.frameThisPoint(sellVolumePoint2); + sellVolumePoint3 = thisObject.container.frame.frameThisPoint(sellVolumePoint3); + sellVolumePoint4 = thisObject.container.frame.frameThisPoint(sellVolumePoint4); const OPACITY = '0.40'; @@ -203,7 +203,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() { y: y }; - labelPoint = currentVolumePanel.container.frame.frameThisPoint(labelPoint); + labelPoint = thisObject.container.frame.frameThisPoint(labelPoint); browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + opacity + ')'; browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y);