diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index 397fec305..16a92535e 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/FileCursor.js b/FileCursor.js index 5fa883888..d59188a28 100644 --- a/FileCursor.js +++ b/FileCursor.js @@ -36,13 +36,11 @@ function newFileCursor() { cursorDate = pCursorDate; timePeriod = pTimePeriod; - setTimePeriod(pCurrentTimePeriod); - - getFiles(callBackFunction); + setTimePeriod(pCurrentTimePeriod, callBackFunction); } - function setTimePeriod(pTimePeriod) { + function setTimePeriod(pTimePeriod, callBackFunction) { /* @@ -86,6 +84,9 @@ function newFileCursor() { } + getFiles(callBackFunction); + + collectGarbage(); function enterSavingMode() { @@ -234,8 +235,6 @@ function newFileCursor() { default: } } - - } diff --git a/FileCursorCache.js b/FileCursorCache.js index d7e908eb3..9667d630e 100644 --- a/FileCursorCache.js +++ b/FileCursorCache.js @@ -1,6 +1,8 @@  function newFileCursorCache() { + const CONSOLE_LOG = true; + let fileCursorCache = { getFileCursor: getFileCursor, setDatetime: setDatetime, @@ -86,16 +88,30 @@ function newFileCursorCache() { } - console.log("FileCursorCache -> setDatetime -> expectedFiles = " + expectedFiles) + if (CONSOLE_LOG === true) { + + console.log("FileCursorCache -> setDatetime -> expectedFiles = " + expectedFiles); + + } } function setTimePeriod(pTimePeriod) { + filesLoaded = 0; + expectedFiles = 0; + fileCursors.forEach(setTimePeriodToEach) - function setTimePeriodToEach(value, key, map) { + function setTimePeriodToEach(fileCursor, key, map) { - value.setTimePeriod(pTimePeriod); + fileCursor.setTimePeriod(pTimePeriod, onFileReceived); + expectedFiles = expectedFiles + fileCursor.getExpectedFiles(); + + } + + if (CONSOLE_LOG === true) { + + console.log("FileCursorCache -> setTimePeriod -> expectedFiles = " + expectedFiles); } } diff --git a/ProductCard.js b/ProductCard.js index ea23d9d35..f8ee628eb 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -14,6 +14,7 @@ onDailyFileLoaded: onDailyFileLoaded, onSingleFileLoaded: onSingleFileLoaded, onDayChanged: onDayChanged, + onTimePeriodChanged: onTimePeriodChanged, getContainer: getContainer, // returns the inner most container that holds the point received by parameter. initialize: initialize }; @@ -119,11 +120,37 @@ function onDayChanged() { + /* + + When the datetime changes from one day to another, this forces cursors to potentially load more files, thus we reset this counter and + get ready to receive events on files loaded. + + */ + dailyFileProgressBar.animatedValue = 0; if (CONSOLE_LOG === true) { - console.log("ProductCard -> onDayChanged"); + console.log("ProductCard -> onDayChanged -> dailyFileProgressBar.animatedValue = " + dailyFileProgressBar.animatedValue); + + } + + } + + function onTimePeriodChanged() { + + /* + + When the time period below or equal to 1 hour changes, this forces cursors to potentially load more files, thus we reset this counter and + get ready to receive events on files loaded. + + */ + + dailyFileProgressBar.animatedValue = 0; + + if (CONSOLE_LOG === true) { + + console.log("ProductCard -> onTimePeriodChanged -> dailyFileProgressBar.animatedValue = " + dailyFileProgressBar.animatedValue); } @@ -351,7 +378,7 @@ /* ------------------- Progress Bars -------------------------- */ - const ANIMATED_INCREMENT = 3; + const ANIMATED_INCREMENT = 5; let point1; let point2; @@ -370,6 +397,8 @@ if (marketFileProgressBar.animatedValue >= 100) { + marketFileProgressBar.animatedValue = 100; + marketFileProgressBar.fillStyle = LOADED_FILL_STYLE; marketFileProgressBar.strokeStyle = LOADED_STROKE_STYLE; @@ -429,6 +458,8 @@ if (dailyFileProgressBar.animatedValue >= 100) { + dailyFileProgressBar.animatedValue = 100; + dailyFileProgressBar.fillStyle = LOADED_FILL_STYLE; dailyFileProgressBar.strokeStyle = LOADED_STROKE_STYLE; @@ -488,6 +519,8 @@ if (singleFileProgressBar.animatedValue >= 100) { + singleFileProgressBar.animatedValue = 100; + singleFileProgressBar.fillStyle = LOADED_FILL_STYLE; singleFileProgressBar.strokeStyle = LOADED_STROKE_STYLE; diff --git a/TimelineChart.js b/TimelineChart.js index defe0c5e8..67c313407 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -251,6 +251,14 @@ function newTimelineChart() { let activePlotter = activePlotters[i]; activePlotter.plotter.setTimePeriod(timePeriod); + if (timePeriod <= _1_HOUR_IN_MILISECONDS) { + + for (var i = 0; i < activePlotters.length; i++) { + + activePlotter.productCard.onTimePeriodChanged(); + + } + } } } @@ -303,6 +311,8 @@ function newTimelineChart() { let newDate = new Date(0); newDate.setUTCSeconds(center.x / 1000); + tellProductCardsWhenDayChanges(newDate); + datetime = newDate; for (var i = 0; i < activePlotters.length; i++) { @@ -335,16 +345,14 @@ function newTimelineChart() { } - function setDatetime(pDatetime) { + function tellProductCardsWhenDayChanges(pDatetime) { /* If there is a change in the day, then we tell it to the Product Card so that it can represent the activity of the daily cursors on the UI. */ let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); - let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); + let newDate = Math.trunc(pDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); - datetime = pDatetime; - - if (currentDate !== pDatetime) { + if (currentDate !== newDate) { if (timePeriod <= _1_HOUR_IN_MILISECONDS) { @@ -354,9 +362,14 @@ function newTimelineChart() { activePlotter.productCard.onDayChanged(); } - } } + } + + + function setDatetime(pDatetime) { + + tellProductCardsWhenDayChanges(pDatetime); /* No matter if the day changed or not, we need to inform all visible Plotters. */