Removing INFO LOG and fixing BUG when scaling
This commit is contained in:
1 parent
54f2c2268e
commit
8a308df334
2 files changed
-87
No files matched your search
@@ -2,7 +2,6 @@
|
||||
{
|
||||
|
||||
const MODULE_NAME = "Bands Plotter";
|
||||
const INFO_LOG = false;
|
||||
const ERROR_LOG = true;
|
||||
const INTENSIVE_LOG = false;
|
||||
const logger = newWebDebugLog();
|
||||
@@ -62,8 +61,6 @@
|
||||
function finalize() {
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); }
|
||||
|
||||
/* Stop listening to the necesary events. */
|
||||
|
||||
viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId);
|
||||
@@ -93,8 +90,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
/* Store the information received. */
|
||||
|
||||
marketFiles = pStorage.marketFiles[0];
|
||||
@@ -142,8 +137,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
|
||||
let container;
|
||||
|
||||
/* First we check if this point is inside this space. */
|
||||
@@ -169,8 +162,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); }
|
||||
|
||||
let newMarketFile = marketFiles.getFile(timePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
@@ -189,8 +180,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
if (timePeriod !== pTimePeriod) {
|
||||
|
||||
timePeriod = pTimePeriod;
|
||||
@@ -225,8 +214,6 @@
|
||||
|
||||
function setDatetime(pDatetime) {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
datetime = pDatetime;
|
||||
|
||||
}
|
||||
@@ -235,8 +222,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); }
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
/* This happens only when all of the files in the cursor have been loaded. */
|
||||
@@ -255,8 +240,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); }
|
||||
|
||||
this.container.frame.draw();
|
||||
|
||||
plotChart();
|
||||
@@ -271,8 +254,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
recalculateUsingMarketFiles();
|
||||
@@ -295,8 +276,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); }
|
||||
|
||||
if (fileCursor === undefined) { return; } // We need to wait
|
||||
|
||||
if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor
|
||||
@@ -384,8 +363,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); }
|
||||
|
||||
if (marketFile === undefined) { return; } // Initialization not complete yet.
|
||||
|
||||
let daysOnSides = getSideDays(timePeriod);
|
||||
@@ -429,8 +406,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
//console.log("Olivia > recalculateUsingMarketFiles > total bands generated : " + bands.length);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] recalculateUsingMarketFiles -> err = " + err.stack); }
|
||||
@@ -441,10 +416,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
|
||||
|
||||
if (marketFile === undefined) { return; } // We need the market file to be loaded to make the calculation.
|
||||
|
||||
if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated.
|
||||
|
||||
let minValue = {
|
||||
@@ -465,25 +436,6 @@
|
||||
thisObject.container.frame.height
|
||||
);
|
||||
|
||||
function getMaxRate() {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> getMaxRate -> Entering function."); }
|
||||
|
||||
let maxValue = 0;
|
||||
|
||||
for (let i = 0; i < marketFile.length; i++) {
|
||||
|
||||
let currentMax = marketFile[i][2]; // 2 = movingAvarage.
|
||||
|
||||
if (maxValue < currentMax) {
|
||||
maxValue = currentMax;
|
||||
}
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] recalculateScale -> err = " + err.stack); }
|
||||
@@ -672,8 +624,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); }
|
||||
|
||||
recalculate();
|
||||
|
||||
} catch (err) {
|
||||
@@ -686,8 +636,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); }
|
||||
|
||||
if (Math.random() * 100 > 95) {
|
||||
|
||||
recalculate()
|
||||
@@ -703,8 +651,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); }
|
||||
|
||||
recalculate();
|
||||
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
function newAAMastersPlottersBollingerBandsPercentageBandwidth() {
|
||||
|
||||
const MODULE_NAME = "Bands Plotter";
|
||||
const INFO_LOG = false;
|
||||
const ERROR_LOG = true;
|
||||
const INTENSIVE_LOG = false;
|
||||
const logger = newWebDebugLog();
|
||||
@@ -62,8 +61,6 @@
|
||||
function finalize() {
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] finalize -> Entering function."); }
|
||||
|
||||
/* Stop listening to the necesary events. */
|
||||
|
||||
viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId);
|
||||
@@ -93,8 +90,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
|
||||
/* Store the information received. */
|
||||
|
||||
marketFiles = pStorage.marketFiles[0];
|
||||
@@ -151,8 +146,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
|
||||
|
||||
let container;
|
||||
|
||||
/* First we check if this point is inside this space. */
|
||||
@@ -178,8 +171,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onFilesUpdated -> Entering function."); }
|
||||
|
||||
let newMarketFile = marketFiles.getFile(timePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
@@ -198,8 +189,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
if (timePeriod !== pTimePeriod) {
|
||||
|
||||
timePeriod = pTimePeriod;
|
||||
@@ -234,8 +223,6 @@
|
||||
|
||||
function setDatetime(pDatetime) {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setDatetime -> Entering function."); }
|
||||
|
||||
datetime = pDatetime;
|
||||
|
||||
}
|
||||
@@ -244,8 +231,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onDailyFileLoaded -> Entering function."); }
|
||||
|
||||
if (event.currentValue === event.totalValue) {
|
||||
|
||||
/* This happens only when all of the files in the cursor have been loaded. */
|
||||
@@ -264,8 +249,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); }
|
||||
|
||||
this.container.frame.draw();
|
||||
|
||||
plotChart();
|
||||
@@ -280,8 +263,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
recalculateUsingMarketFiles();
|
||||
@@ -304,8 +285,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingDailyFiles -> Entering function."); }
|
||||
|
||||
if (fileCursor === undefined) { return; } // We need to wait
|
||||
|
||||
if (fileCursor.files.size === 0) { return; } // We need to wait until there are files in the cursor
|
||||
@@ -393,8 +372,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateUsingMarketFiles -> Entering function."); }
|
||||
|
||||
if (marketFile === undefined) { return; } // Initialization not complete yet.
|
||||
|
||||
let daysOnSides = getSideDays(timePeriod);
|
||||
@@ -450,8 +427,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleX -> Entering function."); }
|
||||
|
||||
var minValue = {
|
||||
x: MIN_PLOTABLE_DATE.valueOf()
|
||||
};
|
||||
@@ -482,8 +457,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculateScaleY -> Entering function."); }
|
||||
|
||||
var minValue = {
|
||||
y: 0
|
||||
};
|
||||
@@ -893,8 +866,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onZoomChanged -> Entering function."); }
|
||||
|
||||
recalculate();
|
||||
|
||||
} catch (err) {
|
||||
@@ -907,8 +878,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onOffsetChanged -> Entering function."); }
|
||||
|
||||
if (Math.random() * 100 > 95) {
|
||||
|
||||
recalculate()
|
||||
@@ -924,8 +893,6 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] onDragFinished -> Entering function."); }
|
||||
|
||||
recalculate();
|
||||
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user