timelinechart code cleaning

This commit is contained in:
Luis Fernando Molina committed 2018-05-07 11:10:32 +02:00
1 parent 998a84478d
commit 20ad97e2c5
3 files changed
+62 -54

No files matched your search

Binary file not shown.
+61 -53
View File
@@ -2,6 +2,8 @@
const MODULE_NAME = "Timeline Chart";
const INFO_LOG = false;
const INTENSIVE_LOG = false;
const ERROR_LOG = true;
const logger = newDebugLog();
logger.fileName = MODULE_NAME;
@@ -13,7 +15,7 @@
let timePeriod = INITIAL_TIME_PERIOD;
let datetime = INITIAL_DATE;
var thisObject = {
let thisObject = {
setDatetime: setDatetime,
container: undefined,
draw: draw,
@@ -21,7 +23,7 @@
initialize: initialize
};
var container = newContainer();
let container = newContainer();
container.initialize();
thisObject.container = container;
@@ -493,7 +495,7 @@
datetime = newDate;
for (var i = 0; i < productPlotters.length; i++) {
for (let i = 0; i < productPlotters.length; i++) {
let productPlotter = productPlotters[i];
@@ -519,7 +521,7 @@
if (INFO_LOG === true) { logger.write("[INFO] getContainer -> Entering function."); }
var container;
let container;
/* First we check if this point is inside this space. */
@@ -545,7 +547,7 @@
if (thisObject.container.frame.isInViewPort()) {
for (var i = 0; i < productPlotters.length; i++) {
for (let i = 0; i < productPlotters.length; i++) {
let productPlotter = productPlotters[i];
@@ -571,8 +573,58 @@
}
}
function recalculateScale() {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
let minValue = {
x: EARLIEST_DATE.valueOf(),
y: 0
};
let maxValue = {
x: MAX_PLOTABLE_DATE.valueOf(),
y: nextPorwerOf10(USDT_BTC_HTH)
};
timeLineCoordinateSystem.initialize(
minValue,
maxValue,
thisObject.container.frame.width,
thisObject.container.frame.height
);
}
function tooTiny() {
if (INTENSIVE_LOG === true) { logger.write("[INFO] tooTiny -> Entering function."); }
if (viewPort.zoomLevel < Math.trunc(-28.25 * 100) / 100) {
return true;
} else {
return false;
}
}
function tooSmall() {
if (INFO_LOG === true) { logger.write("[INFO] tooSmall -> Entering function."); }
if (viewPort.zoomLevel < Math.trunc(-27.25 * 100) / 100) {
return true;
} else {
return false;
}
}
function draw() {
if (INTENSIVE_LOG === true) { logger.write("[INFO] draw -> Entering function."); }
if (productPlotters === undefined) { return; } // We need to wait
if (thisObject.container.frame.isInViewPort()) {
@@ -602,60 +654,16 @@
}
}
function recalculateScale() {
if (INFO_LOG === true) { logger.write("[INFO] recalculateScale -> Entering function."); }
var minValue = {
x: EARLIEST_DATE.valueOf(),
y: 0
};
var maxValue = {
x: MAX_PLOTABLE_DATE.valueOf(),
y: nextPorwerOf10(USDT_BTC_HTH)
};
timeLineCoordinateSystem.initialize(
minValue,
maxValue,
thisObject.container.frame.width,
thisObject.container.frame.height
);
}
function tooTiny() {
if (viewPort.zoomLevel < Math.trunc(-28.25 * 100) / 100) {
return true;
} else {
return false;
}
}
function tooSmall() {
if (INFO_LOG === true) { logger.write("[INFO] tooSmall -> Entering function."); }
if (viewPort.zoomLevel < Math.trunc(-27.25 * 100) / 100) {
return true;
} else {
return false;
}
}
function drawBackground() {
if (INTENSIVE_LOG === true) { logger.write("[INFO] drawBackground -> Entering function."); }
let targetLabelFontSize = 150;
let fontSizeIncrement = 12.5;
let currentFontSize = 150;
var market = markets.get(marketId);
var label = market.assetA + " " + market.assetB;
let market = markets.get(marketId);
let label = market.assetA + " " + market.assetB;
//label = '' + level; // Math.trunc(timePeriod / 1000 / 60);
+1 -1
View File
@@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) {
}
const DEBUG_MODE = false; // This forces the server to read Plotters from the local drive.
const DEBUG_MODE = true; // This forces the server to read Plotters from the local drive.
if (CONSOLE_LOG === true && DEBUG_MODE === true) {