Giving Space for X Auto Scale
This commit is contained in:
1 parent
da6836f77c
commit
95364f5233
5 files changed
+32
-28
No files matched your search
@@ -15,10 +15,10 @@ function newCoordinateSystem () {
|
||||
maxWidth: undefined,
|
||||
scale: undefined,
|
||||
eventHandler: undefined,
|
||||
autoMinScale: true,
|
||||
autoMaxScale: true,
|
||||
autoMinYScale: true,
|
||||
autoMaxYScale: true,
|
||||
physics: physics,
|
||||
reportValue: reportValue,
|
||||
reportYValue: reportYValue,
|
||||
zoomX: zoomX,
|
||||
zoomY: zoomY,
|
||||
recalculateScale: recalculateScale,
|
||||
@@ -50,7 +50,7 @@ function newCoordinateSystem () {
|
||||
|
||||
let newMax = -VERY_LARGE_NUMBER
|
||||
let newMin = VERY_LARGE_NUMBER
|
||||
let notValueReported = true
|
||||
let noYValueReported = true
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -74,25 +74,25 @@ function newCoordinateSystem () {
|
||||
}
|
||||
|
||||
function physics () {
|
||||
if ((thisObject.autoMinScale === true || thisObject.autoMaxScale === true) && notValueReported === false) {
|
||||
if ((thisObject.autoMinYScale === true || thisObject.autoMaxYScale === true) && noYValueReported === false) {
|
||||
let mustRecalculate = false
|
||||
|
||||
if (thisObject.autoMaxScale === true && thisObject.max.y !== newMax) {
|
||||
if (thisObject.autoMaxYScale === true && thisObject.max.y !== newMax) {
|
||||
thisObject.max.y = newMax
|
||||
mustRecalculate = true
|
||||
}
|
||||
|
||||
if (thisObject.autoMaxScale === true) {
|
||||
if (thisObject.autoMaxYScale === true) {
|
||||
newMax = -VERY_LARGE_NUMBER
|
||||
}
|
||||
|
||||
if (thisObject.autoMinScale === true && thisObject.min.y !== newMin) {
|
||||
if (thisObject.autoMinYScale === true && thisObject.min.y !== newMin) {
|
||||
thisObject.min.y = newMin
|
||||
newMin = VERY_LARGE_NUMBER
|
||||
mustRecalculate = true
|
||||
}
|
||||
|
||||
if (thisObject.autoMinScale === true) {
|
||||
if (thisObject.autoMinYScale === true) {
|
||||
newMin = VERY_LARGE_NUMBER
|
||||
}
|
||||
|
||||
@@ -102,18 +102,18 @@ function newCoordinateSystem () {
|
||||
|
||||
/* Reseting this to start over at each cycle. */
|
||||
|
||||
notValueReported = true
|
||||
noYValueReported = true
|
||||
}
|
||||
}
|
||||
|
||||
function reportValue (value) {
|
||||
if (thisObject.autoMinScale === true) {
|
||||
function reportYValue (value) {
|
||||
if (thisObject.autoMinYScale === true) {
|
||||
if (value < newMin) { newMin = value }
|
||||
notValueReported = false
|
||||
noYValueReported = false
|
||||
}
|
||||
if (thisObject.autoMaxScale === true) {
|
||||
if (thisObject.autoMaxYScale === true) {
|
||||
if (value > newMax) { newMax = value }
|
||||
notValueReported = false
|
||||
noYValueReported = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -569,7 +569,7 @@ function newPlotter () {
|
||||
y: y
|
||||
}
|
||||
/* Contributing to Auto-Scale */
|
||||
coordinateSystem.reportValue(dataPoint.y)
|
||||
coordinateSystem.reportYValue(dataPoint.y)
|
||||
|
||||
/*
|
||||
The information we store in files is independent from the charing system and its coordinate systems.
|
||||
@@ -769,7 +769,7 @@ function newPlotter () {
|
||||
}
|
||||
}
|
||||
|
||||
if (coordinateSystem.autoMinScale === true || coordinateSystem.autosMaxScale === true) {
|
||||
if (coordinateSystem.autoMinYScale === true || coordinateSystem.autosMaxScale === true) {
|
||||
mustRecalculateDataPoints = true
|
||||
} else {
|
||||
mustRecalculateDataPoints = false
|
||||
|
||||
@@ -37,8 +37,8 @@ function newAutoScaleButton () {
|
||||
|
||||
function initialize (pCoordinateSystem) {
|
||||
coordinateSystem = pCoordinateSystem
|
||||
thisObject.autoMinScale = coordinateSystem.autoMinScale
|
||||
thisObject.autoMaxScale = coordinateSystem.autoMaxScale
|
||||
thisObject.autoMinScale = coordinateSystem.autoMinYScale
|
||||
thisObject.autoMaxScale = coordinateSystem.autoMaxYScale
|
||||
|
||||
thisObject.container.frame.width = 25
|
||||
thisObject.container.frame.height = 25
|
||||
@@ -81,8 +81,8 @@ function newAutoScaleButton () {
|
||||
}
|
||||
|
||||
function update () {
|
||||
coordinateSystem.autoMinScale = thisObject.autoMinScale
|
||||
coordinateSystem.autoMaxScale = thisObject.autoMaxScale
|
||||
coordinateSystem.autoMinYScale = thisObject.autoMinScale
|
||||
coordinateSystem.autoMaxYScale = thisObject.autoMaxScale
|
||||
coordinateSystem.recalculateScale()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -169,8 +169,8 @@ function newRateScale () {
|
||||
let code = JSON.parse(thisObject.payload.node.code)
|
||||
code.minValue = coordinateSystem.min.y
|
||||
code.maxValue = coordinateSystem.max.y
|
||||
code.autoMinScale = coordinateSystem.autoMinScale
|
||||
code.autoMaxScale = coordinateSystem.autoMaxScale
|
||||
code.autoMinScale = coordinateSystem.autoMinYScale
|
||||
code.autoMaxScale = coordinateSystem.autoMaxYScale
|
||||
thisObject.payload.node.code = JSON.stringify(code, null, 4)
|
||||
} catch (err) {
|
||||
// we ignore errors here since most likely they will be parsing errors.
|
||||
@@ -190,8 +190,8 @@ function newRateScale () {
|
||||
if (
|
||||
thisObject.minValue !== code.minValue ||
|
||||
thisObject.maxValue !== code.maxValue ||
|
||||
coordinateSystem.autoMinScale !== code.autoMinScale ||
|
||||
coordinateSystem.autoMaxScale !== code.autoMaxScale
|
||||
coordinateSystem.autoMinYScale !== code.autoMinScale ||
|
||||
coordinateSystem.autoMaxYScale !== code.autoMaxScale
|
||||
) {
|
||||
thisObject.minValue = code.minValue
|
||||
thisObject.maxValue = code.maxValue
|
||||
@@ -199,11 +199,11 @@ function newRateScale () {
|
||||
coordinateSystem.max.y = thisObject.maxValue
|
||||
|
||||
if (code.autoMinScale !== undefined && (code.autoMinScale === true || code.autoMinScale === false)) {
|
||||
coordinateSystem.autoMinScale = code.autoMinScale
|
||||
coordinateSystem.autoMinYScale = code.autoMinScale
|
||||
autoScaleButton.autoMinScale = code.autoMinScale
|
||||
}
|
||||
if (code.autoMaxScale !== undefined && (code.autoMaxScale === true || code.autoMaxScale === false)) {
|
||||
coordinateSystem.autoMaxScale = code.autoMaxScale
|
||||
coordinateSystem.autoMaxYScale = code.autoMaxScale
|
||||
autoScaleButton.autoMaxScale = code.autoMaxScale
|
||||
}
|
||||
coordinateSystem.recalculateScale()
|
||||
|
||||
@@ -247,7 +247,11 @@ function newDesignSpace () {
|
||||
'toggle-auto-scale-auto-min-max',
|
||||
'toggle-auto-scale-auto-max',
|
||||
'toggle-auto-scale-auto-min',
|
||||
'toggle-panel-off'
|
||||
'toggle-panel-off',
|
||||
'toggle-auto-time-scale-auto-min',
|
||||
'toggle-auto-time-scale-auto-max',
|
||||
'toggle-auto-time-scale-auto-min-max',
|
||||
'toggle-auto-time-scale-manual'
|
||||
]
|
||||
|
||||
for (let i = 0; i < iconsNames.length; i++) {
|
||||
|
||||
Reference in new issue
Block a user