From 144a7f5aa26555dc2d55f49ad0e55763d72504f0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 24 Mar 2020 16:10:15 +0100 Subject: [PATCH] Bug fixed --- ChartingSpace/CoordinateSystem.js | 4 ++++ ChartingSpace/TimelineChart.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChartingSpace/CoordinateSystem.js b/ChartingSpace/CoordinateSystem.js index 4fbfc24bd..4e28a1716 100644 --- a/ChartingSpace/CoordinateSystem.js +++ b/ChartingSpace/CoordinateSystem.js @@ -105,6 +105,10 @@ function newCoordinateSystem () { /* Reseting this to start over at each cycle. */ noXValueReported = true + + if (mustRecalculate === true) { + thisObject.eventHandler.raiseEvent('X-Range Changed') + } } if ((thisObject.autoMinYScale === true || thisObject.autoMaxYScale === true) && noYValueReported === false) { diff --git a/ChartingSpace/TimelineChart.js b/ChartingSpace/TimelineChart.js index f827726c0..44e96a02a 100644 --- a/ChartingSpace/TimelineChart.js +++ b/ChartingSpace/TimelineChart.js @@ -43,6 +43,7 @@ function newTimelineChart () { let timeFrameScaleEventSuscriptionId let timeFrameScaleMouseOverEventSuscriptionId let scaleChangedEventSubscriptionId + let xRangeChangedEventSubscriptionId let drawScales = false let mouse = { @@ -63,6 +64,7 @@ function newTimelineChart () { function finalize () { coordinateSystem.eventHandler.stopListening(scaleChangedEventSubscriptionId) + timelineChartCoordinateSystem.eventHandler.stopListening(xRangeChangedEventSubscriptionId) if (thisObject.layersManager !== undefined) { finalizeLayersManager() @@ -145,6 +147,7 @@ function newTimelineChart () { onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) scaleChangedEventSubscriptionId = timeMachineCoordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) + xRangeChangedEventSubscriptionId = timelineChartCoordinateSystem.eventHandler.listenToEvent('X-Range Changed', xRangeChanged) } function initializeCoordinateSystem () { @@ -231,6 +234,15 @@ function newTimelineChart () { } } + function xRangeChanged (event) { + if (thisObject.rateScale !== undefined) { + /* We need to re trasmit the changes on the x Range of the timelinechart coordinate system to the time machine coordinate system so that its scale is syncronized. */ + timeMachineCoordinateSystem.min.x = timelineChartCoordinateSystem.min.x + timeMachineCoordinateSystem.max.x = timelineChartCoordinateSystem.max.x + timeMachineCoordinateSystem.recalculateScale() + } + } + function onScaleChanged (event) { if (thisObject.rateScale !== undefined) { thisObject.rateScale.onUpstreamScaleChanged(event)