From 6394fe261900c91a05f55123c9eddf25aa0ef427 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 11 Jan 2020 09:15:17 +0100 Subject: [PATCH] Cleaning unued code --- ChartsSpace/TimeMachine.js | 18 +++++++++++++++++- ChartsSpace/TimelineChart.js | 19 +++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ChartsSpace/TimeMachine.js b/ChartsSpace/TimeMachine.js index 1653d556e..db77c5505 100644 --- a/ChartsSpace/TimeMachine.js +++ b/ChartsSpace/TimeMachine.js @@ -14,6 +14,8 @@ function newTimeMachine () { const logger = newWebDebugLog() logger.fileName = MODULE_NAME + let timeFrame = INITIAL_TIME_PERIOD + let thisObject = { container: undefined, timeScale: undefined, @@ -46,9 +48,11 @@ function newTimeMachine () { let onMouseOverEventSuscriptionId let onMouseNotOverEventSuscriptionId let timeScaleEventSuscriptionId - let rateScaleEventSuscriptionId let timeScaleMouseOverEventSuscriptionId + let rateScaleEventSuscriptionId let rateScaleMouseOverEventSuscriptionId + let timeFrameScaleEventSuscriptionId + let timeFrameScaleMouseOverEventSuscriptionId setupContainer() return thisObject @@ -73,6 +77,10 @@ function newTimeMachine () { finalizeRateScale() } + if (thisObject.timeFrameScale !== undefined) { + finalizeTimeFrameScale() + } + thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) thisObject.container.eventHandler.stopListening(onMouseNotOverEventSuscriptionId) @@ -108,7 +116,15 @@ function newTimeMachine () { thisObject.rateScale = undefined } + function finalizeTimeFrameScale () { + thisObject.timeFrameScale.container.eventHandler.stopListening(timeFrameScaleEventSuscriptionId) + thisObject.timeFrameScale.container.eventHandler.stopListening(timeFrameScaleMouseOverEventSuscriptionId) + thisObject.timeFrameScale.finalize() + thisObject.timeFrameScale = undefined + } + function initialize (callBackFunction) { + timeFrame = INITIAL_TIME_PERIOD recalculateScale() onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) diff --git a/ChartsSpace/TimelineChart.js b/ChartsSpace/TimelineChart.js index e5c7b9de5..457f858c5 100644 --- a/ChartsSpace/TimelineChart.js +++ b/ChartsSpace/TimelineChart.js @@ -17,7 +17,6 @@ function newTimelineChart () { timeFrameScale: undefined, payload: undefined, physics: physics, - setDatetime: setDatetime, drawBackground: drawBackground, draw: draw, getContainer: getContainer, @@ -91,7 +90,7 @@ function newTimelineChart () { function initialize (pExchange, pMarket, pTimeLineCoordinateSystem, callBackFunction) { try { - /* We load the logow we will need for the background. */ + /* We load the logow we will need for the background. */ exchange = pExchange market = pMarket timeLineCoordinateSystem = pTimeLineCoordinateSystem @@ -105,13 +104,11 @@ function newTimelineChart () { timeFrame = INITIAL_TIME_PERIOD datetime = NEW_SESSION_INITIAL_DATE - /* Event Subscriptions - we need this events to be fired first here and then in active Plotters. */ - + /* Event Subscriptions - we need this events to be fired first here and then in active Plotters. */ onOffsetChangedEventSuscriptionId = viewPort.eventHandler.listenToEvent('Offset Changed', onOffsetChanged) onZoomChangedEventSuscriptionId = viewPort.eventHandler.listenToEvent('Zoom Changed', onZoomChanged) - /* Initialize the Plotter Manager */ - + /* Initialize the Plotter Manager */ plotterManager = newPlottersManager() plotterManager.container.connectToParent(thisObject.container, true, true, false, true, true, true, false, false, true) @@ -197,16 +194,6 @@ function newTimelineChart () { } } - function setDatetime (pDatetime) { - /* This function is used when the time is changed through the user interface, but without zooming or panning. */ - /* No matter if the day changed or not, we need to inform all visible Plotters. */ - - if (thisObject.container.frame.isInViewPort()) { - plotterManager.setDatetime(pDatetime) - plotterManager.positionAtDatetime(pDatetime) - } - } - function onOffsetChanged () { if (initializationReady === true) { if (thisObject.container.frame.isInViewPort()) {