UNPKG

sigplot-ts

Version:

TypeScript-based Integration Library for SigPlot 2.0

68 lines 2.71 kB
"use strict"; /** * Author: Thomas Goodwin * Company: Geon Technologies, LLC * * Generic raster plot */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = require("../../plot/index"); var index_2 = require("../../bluefile/index"); var DEFAULT_SIGNAL = 'signal'; /** * RasterPlot provides a basic 2D "falling raster" (a.k.a., waterfall) plot of * one's data. * @preferred */ var RasterPlot = /** @class */ (function (_super) { __extends(RasterPlot, _super); function RasterPlot() { return _super !== null && _super.apply(this, arguments) || this; } /** Get the SigPlot layer */ RasterPlot.prototype.getLayer = function () { return this._plot.get_layer(this._layerN); }; /** Remove the SigPlot layer */ RasterPlot.prototype.removeLayer = function () { if (this._plot.get_layer(this._layerN) !== null) { this._plot.remove_layer(this._layerN); } }; /** * Push the data buffer and other information to the plot. * @param plotData - buffer and parameters to plot */ RasterPlot.prototype.push = function (plotData) { if (plotData.dataId === undefined) { plotData.dataId = DEFAULT_SIGNAL; } var options = index_2.BlueHeaderOptions.type2000(plotData.dataSize, plotData.dataType, plotData.xAxis, plotData.yAxis, plotData.buffer.length, plotData.timeCode); if (!this.getLayer()) { this._layerN = this._plot.overlay_pipe(options); } // For type 2000 plots, the signal name is the file_name in the // resulting bluefile descriptor, which we don't have (we have the // options that make it). So we create the layer, fetch it, and change // it's 'name', which is the internal name that will appear on the // legend. var layer = this.getLayer(); layer.name = plotData.dataId; // Adjust the plot for the data length and push to the plot // TODO: sync and/or rsync? this._plot.push(this._layerN, plotData.buffer, options); }; return RasterPlot; }(index_1.BasePlot)); exports.RasterPlot = RasterPlot; //# sourceMappingURL=raster-plot.js.map