From 8d1d887eff7d7e6c2283127ea6d0a058ee82cdb1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 20 Jan 2020 09:30:14 +0100 Subject: [PATCH] tunning scales --- ChartsSpace/TimeMachine.js | 4 ++-- ChartsSpace/TimelineChart.js | 2 +- Globals.js | 4 ++-- Scales/RateScale.js | 12 ++++++------ Scales/TimeScale.js | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ChartsSpace/TimeMachine.js b/ChartsSpace/TimeMachine.js index b6d43ddb1..5baf9bb8c 100644 --- a/ChartsSpace/TimeMachine.js +++ b/ChartsSpace/TimeMachine.js @@ -184,7 +184,7 @@ function newTimeMachine () { thisObject.timeScale.initialize(timeMachineCoordinateSystem, thisObject.container) function timeScaleValueChanged (event) { - thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.scale + thisObject.container.frame.width = TIME_MACHINE_WIDTH + TIME_MACHINE_WIDTH * event.scale recalculateCoordinateSystem() if (event.isUserAction === true) { moveToUserPosition(thisObject.container, timeMachineCoordinateSystem, false, true, event.mousePosition, true) @@ -206,7 +206,7 @@ function newTimeMachine () { thisObject.rateScale.initialize(timeMachineCoordinateSystem, thisObject.container, thisObject.container) function rateScaleValueChanged (event) { - thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.scale + thisObject.container.frame.height = TIME_MACHINE_HEIGHT + TIME_MACHINE_HEIGHT * event.scale recalculateCoordinateSystem() if (event.isUserAction === true) { moveToUserPosition(thisObject.container, timeMachineCoordinateSystem, true, false, event.mousePosition, true) diff --git a/ChartsSpace/TimelineChart.js b/ChartsSpace/TimelineChart.js index cb8495344..d8107082b 100644 --- a/ChartsSpace/TimelineChart.js +++ b/ChartsSpace/TimelineChart.js @@ -188,7 +188,7 @@ function newTimelineChart () { } function rateScaleValueChanged (event) { - thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.scale + thisObject.container.frame.height = TIME_MACHINE_HEIGHT + TIME_MACHINE_HEIGHT * event.scale recalculateCoordinateSystem() thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event) } diff --git a/Globals.js b/Globals.js index 66c535e1e..e3d45800f 100644 --- a/Globals.js +++ b/Globals.js @@ -188,8 +188,8 @@ const PERIOD_01_MIN = "01-min"; We define here the size of the chartSpace. It has to bee enough big in order to accomodate all the charts we expect to display in this space. */ -const TIME_MACHINE_WIDTH = 2000; -const TIME_MACHINE_HEIGHT = 200 / 25; +const TIME_MACHINE_WIDTH = 250; +const TIME_MACHINE_HEIGHT = 250 / 50; function toRadians(angle) { return angle * (Math.PI / 180); diff --git a/Scales/RateScale.js b/Scales/RateScale.js index a7f0e8e52..91ee28952 100644 --- a/Scales/RateScale.js +++ b/Scales/RateScale.js @@ -18,17 +18,17 @@ function newRateScale () { finalize: finalize } - const DEFAULT_SCALE = 25 + const DEFAULT_SCALE = 50 const STEP_SCALE = 1 - const MIN_SCALE = 1 + const MIN_SCALE = 0 const MAX_SCALE = 100 - const SNAP_THRESHOLD_SCALE = 2 + const SNAP_THRESHOLD_SCALE = 1 const DEFAULT_OFFSET = 0 const STEP_OFFSET = 1 const MIN_OFFSET = -1000 const MAX_OFFSET = 1000 - const SNAP_THRESHOLD_OFFSET = 4 + const SNAP_THRESHOLD_OFFSET = 3 thisObject.container = newContainer() thisObject.container.initialize(MODULE_NAME) @@ -217,7 +217,7 @@ function newRateScale () { try { let code = JSON.parse(thisObject.payload.node.code) code.scale = thisObject.scale / MAX_SCALE * 100 - code.scale = code.scale.toFixed(2) + code.scale = code.scale.toFixed(0) code.offset = thisObject.offset thisObject.payload.node.code = JSON.stringify(code) } catch (err) { @@ -392,7 +392,7 @@ function newRateScale () { } if (scaleTimer > 0) { - label2 = thisObject.scale.toFixed(0) + label2 = (thisObject.scale / MAX_SCALE * 100).toFixed(0) label3 = 'SCALE' } diff --git a/Scales/TimeScale.js b/Scales/TimeScale.js index 8606d4fd6..5d2d193fb 100644 --- a/Scales/TimeScale.js +++ b/Scales/TimeScale.js @@ -16,10 +16,10 @@ function newTimeScale () { finalize: finalize } - const DEFAULT_SCALE = 1 - const STEP_SCALE = 1 - const MIN_SCALE = 1 - const MAX_SCALE = 400 + const DEFAULT_SCALE = 0 + const STEP_SCALE = 2.5 + const MIN_SCALE = 0 + const MAX_SCALE = 250 const SNAP_THRESHOLD_SCALE = 0 thisObject.container = newContainer() @@ -153,7 +153,7 @@ function newTimeScale () { try { let code = JSON.parse(thisObject.payload.node.code) code.scale = thisObject.scale / MAX_SCALE * 100 - code.scale = code.scale.toFixed(2) + code.scale = code.scale.toFixed(0) thisObject.payload.node.code = JSON.stringify(code) } catch (err) { // we ignore errors here since most likely they will be parsing errors. @@ -275,7 +275,7 @@ function newTimeScale () { let backgroundColor = UI_COLOR.BLACK if (scaleTimer > 0) { - label2 = thisObject.scale.toFixed(0) + label2 = (thisObject.scale / MAX_SCALE * 100).toFixed(0) label3 = 'SCALE' }