mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 05:38:12 +00:00
[Plot] Begin separating out plot line handling
Begin separating out plot line buffer from the rest of plot; managing this buffer separately will aid in merging realtime and hsitorical data, WTD-806.
This commit is contained in:
45
platform/features/plot/src/elements/PlotSeriesWindow.js
Normal file
45
platform/features/plot/src/elements/PlotSeriesWindow.js
Normal file
@ -0,0 +1,45 @@
|
||||
/*global define*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Provides a window on a telemetry data series, to support
|
||||
* insertion into a plot line.
|
||||
*/
|
||||
function PlotSeriesWindow(series, domain, range, start, end) {
|
||||
return {
|
||||
getPointCount: function () {
|
||||
return end - start;
|
||||
},
|
||||
getDomainValue: function (index) {
|
||||
return series.getDomainValue(index - start, domain);
|
||||
},
|
||||
getRangeValue: function (index) {
|
||||
return series.getRangeValue(index - start, range);
|
||||
},
|
||||
split: function () {
|
||||
var mid = Math.floor((end + start) / 2);
|
||||
return end > start ?
|
||||
[
|
||||
new PlotSeriesWindow(
|
||||
series,
|
||||
domain,
|
||||
range,
|
||||
start,
|
||||
mid
|
||||
),
|
||||
new PlotSeriesWindow(
|
||||
series,
|
||||
domain,
|
||||
range,
|
||||
mid + 1,
|
||||
end
|
||||
)
|
||||
] : [];
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user