Conditions Plotter and Panel
This commit is contained in:
1 parent
07aedb0563
commit
94a3b8d330
6 files changed
+730
-108
No files matched your search
@@ -77,93 +77,10 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation
|
||||
const X_AXIS = thisObject.container.frame.width / 2;
|
||||
const Y_AXIS = frameTitleHeight + frameBodyHeight / 2;
|
||||
|
||||
var recordPoint1 = {
|
||||
x: X_AXIS - currentRecord.bodyWidth / 2,
|
||||
y: Y_AXIS - currentRecord.leftBodyHeight / 2 - currentRecord.bottomDelta / 4
|
||||
};
|
||||
|
||||
var recordPoint2 = {
|
||||
x: X_AXIS - currentRecord.bodyWidth / 2,
|
||||
y: Y_AXIS + currentRecord.leftBodyHeight / 2 - currentRecord.topDelta / 4
|
||||
};
|
||||
|
||||
var recordPoint3 = {
|
||||
x: X_AXIS + currentRecord.bodyWidth / 2,
|
||||
y: Y_AXIS + currentRecord.rightBodyHeight / 2 + currentRecord.topDelta / 4
|
||||
};
|
||||
|
||||
var recordPoint4 = {
|
||||
x: X_AXIS + currentRecord.bodyWidth / 2,
|
||||
y: Y_AXIS - currentRecord.rightBodyHeight / 2 + currentRecord.bottomDelta / 4
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Extra bounderies due to constrained space */
|
||||
|
||||
const upperLimit = frameTitleHeight + frameBodyHeight * 0.15;
|
||||
const downLimit = frameTitleHeight + frameBodyHeight * 0.85;
|
||||
|
||||
if (recordPoint1.y > downLimit) { recordPoint1.y = downLimit; }
|
||||
if (recordPoint4.y > downLimit) { recordPoint4.y = downLimit; }
|
||||
|
||||
if (recordPoint2.y < upperLimit) { recordPoint2.y = upperLimit; }
|
||||
if (recordPoint3.y < upperLimit) { recordPoint3.y = upperLimit; }
|
||||
|
||||
recordPoint1 = thisObject.container.frame.frameThisPoint(recordPoint1);
|
||||
recordPoint2 = thisObject.container.frame.frameThisPoint(recordPoint2);
|
||||
recordPoint3 = thisObject.container.frame.frameThisPoint(recordPoint3);
|
||||
recordPoint4 = thisObject.container.frame.frameThisPoint(recordPoint4);
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
browserCanvasContext.moveTo(recordPoint1.x, recordPoint1.y);
|
||||
browserCanvasContext.lineTo(recordPoint2.x, recordPoint2.y);
|
||||
browserCanvasContext.lineTo(recordPoint3.x, recordPoint3.y);
|
||||
browserCanvasContext.lineTo(recordPoint4.x, recordPoint4.y);
|
||||
|
||||
browserCanvasContext.closePath();
|
||||
|
||||
const OPACITY = '0.1';
|
||||
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', ' + OPACITY + ')';
|
||||
|
||||
browserCanvasContext.fill();
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
browserCanvasContext.moveTo(recordPoint1.x, recordPoint1.y);
|
||||
browserCanvasContext.lineTo(recordPoint4.x, recordPoint4.y);
|
||||
browserCanvasContext.moveTo(recordPoint2.x, recordPoint2.y);
|
||||
browserCanvasContext.lineTo(recordPoint3.x, recordPoint3.y);
|
||||
|
||||
browserCanvasContext.closePath();
|
||||
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)';
|
||||
|
||||
browserCanvasContext.lineWidth = 0.2;
|
||||
browserCanvasContext.stroke();
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
browserCanvasContext.moveTo(recordPoint1.x, recordPoint1.y + (recordPoint2.y - recordPoint1.y) / 2);
|
||||
browserCanvasContext.lineTo(recordPoint4.x, recordPoint4.y - (recordPoint4.y - recordPoint3.y) / 2);
|
||||
|
||||
|
||||
browserCanvasContext.closePath();
|
||||
|
||||
browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.RUSTED_RED + ', 1)';
|
||||
|
||||
browserCanvasContext.lineWidth = 0.2;
|
||||
browserCanvasContext.stroke();
|
||||
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
/* put the labels with the records values */
|
||||
|
||||
|
||||
|
||||
browserCanvasContext.beginPath();
|
||||
|
||||
let y = 0;
|
||||
let increment = 0.025;
|
||||
@@ -247,21 +164,7 @@ function newAAMastersPlottersTradingSimulationTradingSimulationTradingSimulation
|
||||
printLabel('Anualized Rate of Return', X_AXIS, frameTitleHeight + frameBodyHeight * y, '1');
|
||||
y = y + increment;
|
||||
printLabel((currentRecord.innerRecord.anualizedRateOfReturn * 100).toFixed(2) + ' %', X_AXIS, frameTitleHeight + frameBodyHeight * y, '0.50');
|
||||
|
||||
y = y + increment;
|
||||
y = y + increment;
|
||||
|
||||
for (let i = 0; i < currentRecord.conditionsNames.length; i++) {
|
||||
y = y + increment;
|
||||
let opacity;
|
||||
if (currentRecord.conditionsValues[i] === 1) {
|
||||
opacity = '1.00'
|
||||
} else {
|
||||
opacity = '0.50';
|
||||
}
|
||||
printLabel(currentRecord.conditionsNames[i], X_AXIS, frameTitleHeight + frameBodyHeight * y, opacity);
|
||||
}
|
||||
|
||||
|
||||
function printLabel(labelToPrint, x, y, opacity) {
|
||||
|
||||
let labelPoint;
|
||||
|
||||
Reference in new issue
Block a user