Panels fixes
This commit is contained in:
1 parent
f25d7c3270
commit
38cf1c5455
5 files changed
+117
-10
No files matched your search
@@ -487,12 +487,7 @@ function newRateScale () {
|
||||
rate = coordinateSystem.max.y
|
||||
}
|
||||
|
||||
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 label = dynamicDecimals(rate)
|
||||
let labelArray = label.split('.')
|
||||
let label1 = thisObject.payload.node.payload.parentNode.name
|
||||
let label2 = (Math.trunc(rate)).toLocaleString()
|
||||
|
||||
@@ -22,6 +22,15 @@ function drawContainerBackground (container, color, opacity, fitFunction) {
|
||||
browserCanvasContext.fill()
|
||||
}
|
||||
|
||||
function dynamicDecimals (value) {
|
||||
let decimals = 2
|
||||
if (value < 1) { decimals = 4 }
|
||||
if (Math.trunc(value * 100) < 1) { decimals = 6 }
|
||||
if (Math.trunc(value * 10000) < 1) { decimals = 8 }
|
||||
if (Math.trunc(value * 1000000) < 1) { decimals = 10 }
|
||||
return (value - Math.trunc(value)).toFixed(decimals)
|
||||
}
|
||||
|
||||
function savePropertyAtNodeConfig (payload, propertyName, value) {
|
||||
try {
|
||||
let code = JSON.parse(payload.node.code)
|
||||
|
||||
@@ -118,8 +118,6 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () {
|
||||
y: Y_AXIS - currentBand.rightBodyHeight / 2 + currentBand.bottomDelta / 4
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Extra bounderies due to constrained space */
|
||||
|
||||
const upperLimit = frameTitleHeight + frameBodyHeight * 0.15;
|
||||
@@ -131,6 +129,15 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () {
|
||||
if (bandPoint2.y < upperLimit) { bandPoint2.y = upperLimit; }
|
||||
if (bandPoint3.y < upperLimit) { bandPoint3.y = upperLimit; }
|
||||
|
||||
const leftLimit = thisObject.container.frame.width * 0.40;
|
||||
const rightLimit = thisObject.container.frame.width * 0.60;
|
||||
|
||||
if (bandPoint1.x < leftLimit) { bandPoint1.x = leftLimit; }
|
||||
if (bandPoint2.x < leftLimit) { bandPoint2.x = leftLimit; }
|
||||
|
||||
if (bandPoint3.x > rightLimit) { bandPoint3.x = rightLimit; }
|
||||
if (bandPoint4.x > rightLimit) { bandPoint4.x = rightLimit; }
|
||||
|
||||
bandPoint1 = thisObject.container.frame.frameThisPoint(bandPoint1);
|
||||
bandPoint2 = thisObject.container.frame.frameThisPoint(bandPoint2);
|
||||
bandPoint3 = thisObject.container.frame.frameThisPoint(bandPoint3);
|
||||
@@ -213,9 +220,10 @@ function newMastersPlottersBollingerBandsBollingerBandsBollingerBandsPanel () {
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.SECONDARY + ' Saira';
|
||||
|
||||
let label = '' + labelToPrint;
|
||||
let label = labelToPrint
|
||||
if (isNaN(label) === false) {
|
||||
label = Number(label).toLocaleString();
|
||||
label = dynamicDecimals(labelToPrint)
|
||||
label = label.toLocaleString();
|
||||
}
|
||||
let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO;
|
||||
|
||||
|
||||
@@ -202,6 +202,65 @@ function newMastersPlottersCandlesVolumesCandlesCandlePanel() {
|
||||
|
||||
}
|
||||
|
||||
const leftLimit = thisObject.container.frame.width * 0.40;
|
||||
const rightLimit = thisObject.container.frame.width * 0.60;
|
||||
|
||||
if (candlePoint1.x < leftLimit) {
|
||||
|
||||
candlePoint1.x = leftLimit;
|
||||
candlePoint4.x = leftLimit;
|
||||
|
||||
}
|
||||
|
||||
if (stickPoint1.x < leftLimit) {
|
||||
|
||||
stickPoint1.x = leftLimit;
|
||||
stickPoint4.x = leftLimit;
|
||||
|
||||
}
|
||||
|
||||
if (candlePoint4.x < leftLimit) {
|
||||
|
||||
candlePoint4.x = leftLimit;
|
||||
candlePoint1.x = leftLimit;
|
||||
|
||||
}
|
||||
|
||||
if (stickPoint4.x < leftLimit) {
|
||||
|
||||
stickPoint4.x = leftLimit;
|
||||
stickPoint1.x = leftLimit;
|
||||
|
||||
}
|
||||
|
||||
if (candlePoint2.x > rightLimit) {
|
||||
|
||||
candlePoint2.x = rightLimit;
|
||||
candlePoint3.x = rightLimit;
|
||||
|
||||
}
|
||||
|
||||
if (stickPoint2.x > rightLimit) {
|
||||
|
||||
stickPoint2.x = rightLimit;
|
||||
stickPoint3.x = rightLimit;
|
||||
|
||||
}
|
||||
|
||||
if (candlePoint3.x > rightLimit) {
|
||||
|
||||
candlePoint3.x = rightLimit;
|
||||
candlePoint2.x = rightLimit;
|
||||
|
||||
}
|
||||
|
||||
if (stickPoint3.x > rightLimit) {
|
||||
|
||||
stickPoint3.x = rightLimit;
|
||||
stickPoint2.x = rightLimit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
candlePoint1 = thisObject.container.frame.frameThisPoint(candlePoint1);
|
||||
candlePoint2 = thisObject.container.frame.frameThisPoint(candlePoint2);
|
||||
|
||||
@@ -118,6 +118,28 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() {
|
||||
y: Y_AXIS_BUY
|
||||
};
|
||||
|
||||
/* Extra bounderies due to constrained space */
|
||||
|
||||
const upperLimit = frameTitleHeight + frameBodyHeight * 0.15;
|
||||
const downLimit = frameTitleHeight + frameBodyHeight * 0.85;
|
||||
|
||||
const leftLimit = thisObject.container.frame.width * 0.40;
|
||||
const rightLimit = thisObject.container.frame.width * 0.60;
|
||||
|
||||
if (buyVolumePoint1.y < downLimit) { buyVolumePoint1.y = downLimit; }
|
||||
if (buyVolumePoint4.y < downLimit) { buyVolumePoint4.y = downLimit; }
|
||||
|
||||
if (buyVolumePoint2.y < upperLimit) { buyVolumePoint2.y = upperLimit; }
|
||||
if (buyVolumePoint3.y < upperLimit) { buyVolumePoint3.y = upperLimit; }
|
||||
|
||||
if (buyVolumePoint1.x < leftLimit) { buyVolumePoint1.x = leftLimit; }
|
||||
if (buyVolumePoint2.x < leftLimit) { buyVolumePoint2.x = leftLimit; }
|
||||
|
||||
if (buyVolumePoint3.x > rightLimit) { buyVolumePoint3.x = rightLimit; }
|
||||
if (buyVolumePoint4.x > rightLimit) { buyVolumePoint4.x = rightLimit; }
|
||||
|
||||
|
||||
|
||||
buyVolumePoint1 = thisObject.container.frame.fitIntoFrame(buyVolumePoint1);
|
||||
buyVolumePoint2 = thisObject.container.frame.fitIntoFrame(buyVolumePoint2);
|
||||
buyVolumePoint3 = thisObject.container.frame.fitIntoFrame(buyVolumePoint3);
|
||||
@@ -153,6 +175,18 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() {
|
||||
y: Y_AXIS_SELL
|
||||
};
|
||||
|
||||
if (sellVolumePoint1.y < upperLimit) { sellVolumePoint1.y = upperLimit; }
|
||||
if (sellVolumePoint4.y < upperLimit) { sellVolumePoint4.y = upperLimit; }
|
||||
|
||||
if (sellVolumePoint2.y > downLimit) { sellVolumePoint2.y = downLimit; }
|
||||
if (sellVolumePoint3.y > downLimit) { sellVolumePoint3.y = downLimit; }
|
||||
|
||||
if (sellVolumePoint1.x < leftLimit) { sellVolumePoint1.x = leftLimit; }
|
||||
if (sellVolumePoint2.x < leftLimit) { sellVolumePoint2.x = leftLimit; }
|
||||
|
||||
if (sellVolumePoint3.x > rightLimit) { sellVolumePoint3.x = rightLimit; }
|
||||
if (sellVolumePoint4.x > rightLimit) { sellVolumePoint4.x = rightLimit; }
|
||||
|
||||
sellVolumePoint1 = thisObject.container.frame.fitIntoFrame(sellVolumePoint1);
|
||||
sellVolumePoint2 = thisObject.container.frame.fitIntoFrame(sellVolumePoint2);
|
||||
sellVolumePoint3 = thisObject.container.frame.fitIntoFrame(sellVolumePoint3);
|
||||
@@ -168,6 +202,8 @@ function newMastersPlottersCandlesVolumesVolumesVolumePanel() {
|
||||
sellVolumePoint3 = thisObject.fitFunction(sellVolumePoint3)
|
||||
sellVolumePoint4 = thisObject.fitFunction(sellVolumePoint4)
|
||||
|
||||
|
||||
|
||||
const OPACITY = '0.40';
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
Reference in new issue
Block a user