fitFunction IMplemented

This commit is contained in:
Luis Fernando Molina committed 2019-05-10 20:53:26 +02:00
1 parent 7a1032c51f
commit 36115c63b5
3 files changed
+75 -51

No files matched your search

+35 -23
View File
@@ -1,15 +1,16 @@
function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
var thisObject = {
onEventRaised: onEventRaised,
let thisObject = {
fitFunction: undefined,
container: undefined,
onEventRaised: onEventRaised,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -32,29 +33,30 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
panelTabButton = newPanelTabButton()
panelTabButton.parentContainer = thisObject.container
panelTabButton.container.frame.parentFrame = thisObject.container.frame
panelTabButton.fitFunction = thisObject.fitFunction
panelTabButton.initialize()
}
function getContainer(point) {
var container;
let container;
container = panelTabButton.getContainer(point)
if (container !== undefined) { return container }
/* First we check if this point is inside this space. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container;
let checkPoint = {
x: point.x,
y: point.y
}
} else {
/* This point does not belong to this space. */
return undefined;
}
checkPoint = thisObject.fitFunction(checkPoint)
if (point.x === checkPoint.x && point.y === checkPoint.y) {
return thisObject.container;
}
}
}
@@ -67,11 +69,12 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
function draw() {
thisObject.container.frame.draw(false, false, true);
thisObject.container.frame.draw(false, false, true, thisObject.fitFunction);
plotCurrentCandleInfo();
panelTabButton.draw()
}
@@ -86,43 +89,43 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
const X_AXIS = thisObject.container.frame.width / 2;
const Y_AXIS = frameTitleHeight + frameBodyHeight / 2;
var candlePoint1 = {
let candlePoint1 = {
x: X_AXIS - currentCandle.bodyWidth / 2,
y: Y_AXIS - currentCandle.bodyHeight / 2
};
var candlePoint2 = {
let candlePoint2 = {
x: X_AXIS + currentCandle.bodyWidth / 2,
y: Y_AXIS - currentCandle.bodyHeight / 2
};
var candlePoint3 = {
let candlePoint3 = {
x: X_AXIS + currentCandle.bodyWidth / 2,
y: Y_AXIS + currentCandle.bodyHeight / 2
};
var candlePoint4 = {
let candlePoint4 = {
x: X_AXIS - currentCandle.bodyWidth / 2,
y: Y_AXIS + currentCandle.bodyHeight / 2
};
var stickPoint1 = {
let stickPoint1 = {
x: X_AXIS - currentCandle.stickWidth / 2,
y: candlePoint1.y - currentCandle.stickStart
};
var stickPoint2 = {
let stickPoint2 = {
x: X_AXIS + currentCandle.stickWidth / 2,
y: candlePoint1.y - currentCandle.stickStart
};
var stickPoint3 = {
let stickPoint3 = {
x: X_AXIS + currentCandle.stickWidth / 2,
y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight
};
var stickPoint4 = {
let stickPoint4 = {
x: X_AXIS - currentCandle.stickWidth / 2,
y: candlePoint1.y - currentCandle.stickStart + currentCandle.stickHeight
};
@@ -195,12 +198,20 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
candlePoint3 = thisObject.container.frame.frameThisPoint(candlePoint3);
candlePoint4 = thisObject.container.frame.frameThisPoint(candlePoint4);
candlePoint1 = thisObject.fitFunction(candlePoint1)
candlePoint2 = thisObject.fitFunction(candlePoint2)
candlePoint3 = thisObject.fitFunction(candlePoint3)
candlePoint4 = thisObject.fitFunction(candlePoint4)
stickPoint1 = thisObject.container.frame.frameThisPoint(stickPoint1);
stickPoint2 = thisObject.container.frame.frameThisPoint(stickPoint2);
stickPoint3 = thisObject.container.frame.frameThisPoint(stickPoint3);
stickPoint4 = thisObject.container.frame.frameThisPoint(stickPoint4);
stickPoint1 = thisObject.fitFunction(stickPoint1)
stickPoint2 = thisObject.fitFunction(stickPoint2)
stickPoint3 = thisObject.fitFunction(stickPoint3)
stickPoint4 = thisObject.fitFunction(stickPoint4)
browserCanvasContext.beginPath();
@@ -294,6 +305,7 @@ function newAAMastersPlottersCandlesVolumesCandlesCandlePanel() {
};
labelPoint = thisObject.container.frame.frameThisPoint(labelPoint);
labelPoint = thisObject.fitFunction(labelPoint)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')';
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y);
+34 -22
View File
@@ -1,15 +1,16 @@
function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
var thisObject = {
onEventRaised: onEventRaised,
let thisObject = {
fitFunction: undefined,
container: undefined,
onEventRaised: onEventRaised,
draw: draw,
getContainer: getContainer,
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -32,29 +33,30 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
panelTabButton = newPanelTabButton()
panelTabButton.parentContainer = thisObject.container
panelTabButton.container.frame.parentFrame = thisObject.container.frame
panelTabButton.fitFunction = thisObject.fitFunction
panelTabButton.initialize()
}
function getContainer(point) {
var container;
let container;
container = panelTabButton.getContainer(point)
if (container !== undefined) { return container }
/* First we check if this point is inside this space. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container;
let checkPoint = {
x: point.x,
y: point.y
}
} else {
checkPoint = thisObject.fitFunction(checkPoint)
/* This point does not belong to this space. */
return undefined;
if (point.x === checkPoint.x && point.y === checkPoint.y) {
return thisObject.container;
}
}
}
@@ -67,14 +69,13 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
function draw() {
thisObject.container.frame.draw(false, false, true);
thisObject.container.frame.draw(false, false, true, thisObject.fitFunction);
plotCurrentVolumeInfo();
panelTabButton.draw()
}
function plotCurrentVolumeInfo() {
if (currentVolume === undefined) { return; }
@@ -87,22 +88,22 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
const Y_AXIS_BUY = frameTitleHeight + frameBodyHeight * 0.85;
const Y_AXIS_SELL = frameTitleHeight + frameBodyHeight * 0.15;
var buyVolumePoint1 = {
let buyVolumePoint1 = {
x: X_AXIS - currentVolume.buyInfo.baseWidth / 2,
y: Y_AXIS_BUY
};
var buyVolumePoint2 = {
let buyVolumePoint2 = {
x: X_AXIS - currentVolume.buyInfo.topWidth / 2,
y: Y_AXIS_BUY + currentVolume.buyInfo.height
};
var buyVolumePoint3 = {
let buyVolumePoint3 = {
x: X_AXIS + currentVolume.buyInfo.topWidth / 2,
y: Y_AXIS_BUY + currentVolume.buyInfo.height
};
var buyVolumePoint4 = {
let buyVolumePoint4 = {
x: X_AXIS + currentVolume.buyInfo.baseWidth / 2,
y: Y_AXIS_BUY
};
@@ -117,22 +118,27 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
buyVolumePoint3 = thisObject.container.frame.frameThisPoint(buyVolumePoint3);
buyVolumePoint4 = thisObject.container.frame.frameThisPoint(buyVolumePoint4);
var sellVolumePoint1 = {
buyVolumePoint1 = thisObject.fitFunction(buyVolumePoint1)
buyVolumePoint2 = thisObject.fitFunction(buyVolumePoint2)
buyVolumePoint3 = thisObject.fitFunction(buyVolumePoint3)
buyVolumePoint4 = thisObject.fitFunction(buyVolumePoint4)
let sellVolumePoint1 = {
x: X_AXIS - currentVolume.buyInfo.baseWidth / 2,
y: Y_AXIS_SELL
};
var sellVolumePoint2 = {
let sellVolumePoint2 = {
x: X_AXIS - currentVolume.buyInfo.topWidth / 2,
y: Y_AXIS_SELL + currentVolume.sellInfo.height
};
var sellVolumePoint3 = {
let sellVolumePoint3 = {
x: X_AXIS + currentVolume.buyInfo.topWidth / 2,
y: Y_AXIS_SELL + currentVolume.sellInfo.height
};
var sellVolumePoint4 = {
let sellVolumePoint4 = {
x: X_AXIS + currentVolume.buyInfo.baseWidth / 2,
y: Y_AXIS_SELL
};
@@ -147,6 +153,11 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
sellVolumePoint3 = thisObject.container.frame.frameThisPoint(sellVolumePoint3);
sellVolumePoint4 = thisObject.container.frame.frameThisPoint(sellVolumePoint4);
sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1)
sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1)
sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1)
sellVolumePoint1 = thisObject.fitFunction(sellVolumePoint1)
const OPACITY = '0.40';
browserCanvasContext.beginPath();
@@ -216,6 +227,7 @@ function newAAMastersPlottersCandlesVolumesVolumesVolumePanel() {
};
labelPoint = thisObject.container.frame.frameThisPoint(labelPoint);
labelPoint = thisObject.fitFunction(labelPoint)
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.DARK + ', ' + opacity + ')';
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y);
+6 -6
View File
@@ -424,11 +424,11 @@
try {
var minValue = {
let minValue = {
x: MIN_PLOTABLE_DATE.valueOf()
};
var maxValue = {
let maxValue = {
x: MAX_PLOTABLE_DATE.valueOf()
};
@@ -454,11 +454,11 @@
try {
var minValue = {
let minValue = {
y: 0
};
var maxValue = {
let maxValue = {
y: 0
};
@@ -482,7 +482,7 @@
let maxValue = 0;
for (var i = 0; i < scaleFile.length; i++) {
for (let i = 0; i < scaleFile.length; i++) {
let currentMax = (scaleFile[i][0] + scaleFile[i][1]) * 4;
@@ -534,7 +534,7 @@
if (volumes.length > 0) {
for (var i = 0; i < volumes.length; i++) {
for (let i = 0; i < volumes.length; i++) {
volume = volumes[i];