Update Plotter.js
This commit is contained in:
1 parent
c3c29c8f46
commit
d5cd77e655
1 file changed
+15
-38
@@ -293,18 +293,20 @@ function newPlotter() {
|
||||
record.index = dataFile[i][recordDefinition.properties.length]
|
||||
}
|
||||
|
||||
if (
|
||||
(record.begin >= farLeftDate.valueOf() || record.end <= farRightDate.valueOf()) &&
|
||||
(record.end >= coordinateSystem.min.x && record.begin <= coordinateSystem.max.x)
|
||||
) {
|
||||
record.previous = previous
|
||||
jsonifiedArray.push(record)
|
||||
previous = record
|
||||
|
||||
if (record.begin === undefined || record.end === undefined) {
|
||||
console.log('Could not find the property begin or end which are needed for the plotter to work. productDefinition.config.codeName = ' + productDefinition.config.codeName)
|
||||
}
|
||||
if (record.begin === undefined || record.end === undefined) {
|
||||
console.log('Could not find the property begin or end which are needed for the plotter to work. productDefinition.config.codeName = ' + productDefinition.config.codeName)
|
||||
continue
|
||||
}
|
||||
|
||||
if (record.end <= farLeftDate.valueOf()) { continue }
|
||||
if (record.begin >= farRightDate.valueOf()) { continue }
|
||||
|
||||
if (record.end < coordinateSystem.min.x) { continue }
|
||||
if (record.begin > coordinateSystem.max.x) { continue }
|
||||
|
||||
record.previous = previous
|
||||
jsonifiedArray.push(record)
|
||||
previous = record
|
||||
}
|
||||
|
||||
return jsonifiedArray
|
||||
@@ -471,31 +473,6 @@ function newPlotter() {
|
||||
}
|
||||
}
|
||||
|
||||
function recalculateScale() {
|
||||
try {
|
||||
if (coordinateSystem.maxValue > 0) { return } // Already calculated.
|
||||
/* First we calculate the default scale */
|
||||
let minValue = {
|
||||
x: MIN_PLOTABLE_DATE.valueOf(),
|
||||
y: 0
|
||||
}
|
||||
|
||||
let maxValue = {
|
||||
x: MAX_PLOTABLE_DATE.valueOf(),
|
||||
y: nextPorwerOf10(MAX_DEFAULT_RATE_SCALE_VALUE) / 4 // TODO: This 4 is temporary
|
||||
}
|
||||
|
||||
coordinateSystem.initialize(
|
||||
minValue,
|
||||
maxValue,
|
||||
thisObject.container.frame.width,
|
||||
thisObject.container.frame.height
|
||||
)
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] recalculateScale -> err = ' + err.stack) }
|
||||
}
|
||||
}
|
||||
|
||||
function plot() {
|
||||
try {
|
||||
/* Clean the pannel at places where there is no record. */
|
||||
@@ -588,7 +565,7 @@ function newPlotter() {
|
||||
The information we store in files is independent from the charing system and its coordinate systems.
|
||||
That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline.
|
||||
*/
|
||||
let dataPoint
|
||||
let dataPoint
|
||||
dataPoint = coordinateSystem.transformThisPoint(rawPoint)
|
||||
dataPoint = transformThisPoint(dataPoint, thisObject.container)
|
||||
let testPoint = {
|
||||
@@ -764,7 +741,7 @@ function newPlotter() {
|
||||
It can happen that objects that span through a long period of time could have its begin point inside the visible
|
||||
viewport but not its end point. In those cases, the end point should not be reported.
|
||||
*/
|
||||
|
||||
|
||||
if (dataPointObject.rawPoint.y > 1 && dataPointObject.rawPoint.y !== undefined && isNaN(dataPointObject.rawPoint.y) === false) {
|
||||
let rawPoint = coordinateSystem.transformThisPoint(dataPointObject.rawPoint)
|
||||
if (dataPointObject.isInViewPort === true) {
|
||||
|
||||
Reference in new issue
Block a user