From cae4fbada37c40e01f7b9a76f66480ad837f7319 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 31 Jan 2020 17:09:29 +0100 Subject: [PATCH] Rate at timeline chart corrected --- ChartsSpace/TimelineChart.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ChartsSpace/TimelineChart.js b/ChartsSpace/TimelineChart.js index fb39a1a36..dc847a7a0 100644 --- a/ChartsSpace/TimelineChart.js +++ b/ChartsSpace/TimelineChart.js @@ -45,6 +45,7 @@ function newTimelineChart () { let rateScaleUpstreamDimensionsEventSuscriptionId let timeFrameScaleEventSuscriptionId let timeFrameScaleMouseOverEventSuscriptionId + let scaleChangedEventSubscriptionId let drawScales = false let mouse = { @@ -64,6 +65,8 @@ function newTimelineChart () { } function finalize () { + coordinateSystem.eventHandler.stopListening(timelineChartCoordinateSystem) + if (thisObject.layersManager !== undefined) { finalizeLayersManager() } @@ -141,11 +144,13 @@ function newTimelineChart () { timeMachineCoordinateSystem = pTimeMachineCoordinateSystem coordinateSystem = timeMachineCoordinateSystem + onScaleChanged() timeFrame = INITIAL_TIME_PERIOD onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) + scaleChangedEventSubscriptionId = timeMachineCoordinateSystem.eventHandler.listenToEvent('Scale Changed', onScaleChanged) } function initializeLayersManager () { @@ -232,6 +237,12 @@ function newTimelineChart () { } } + function onScaleChanged () { + timelineChartCoordinateSystem.min.x = timeMachineCoordinateSystem.min.x + timelineChartCoordinateSystem.max.x = timeMachineCoordinateSystem.max.x + timelineChartCoordinateSystem.recalculateScale() + } + function setTimeFrame (pTimeFrame) { timeFrame = pTimeFrame if (thisObject.plotterManager !== undefined) { @@ -387,15 +398,20 @@ function newTimelineChart () { function recalculateCoordinateSystem () { let minValue = { - x: MIN_PLOTABLE_DATE.valueOf(), + x: timelineChartCoordinateSystem.min.x, y: 0 } let maxValue = { - x: MAX_PLOTABLE_DATE.valueOf(), + x: timelineChartCoordinateSystem.max.x, y: nextPorwerOf10(MAX_DEFAULT_RATE_SCALE_VALUE) / 4 } + if (thisObject.rateScale !== undefined) { + minValue.y = thisObject.rateScale.minValue + maxValue.y = thisObject.rateScale.maxValue + } + timelineChartCoordinateSystem.initialize( minValue, maxValue,