[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:
Victor Woeltjen
2015-04-17 11:35:24 -07:00
parent 9215eb1427
commit 15b1c824e3
6 changed files with 343 additions and 1 deletions

View 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
)
] : [];
}
};
}
}
);