sigplot-ts
Version:
TypeScript-based Integration Library for SigPlot 2.0
63 lines • 2.23 kB
JavaScript
/**
* Author: Thomas Goodwin
* Company: Geon Technologies, LLC
*
* (Abstract) Base Plot class to encourage a unified API going forward.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var sigplot = require("sigplot");
var constructor_options_1 = require("./constructor-options");
/**
* BasePlot is an abstract base class for sigplot.Plot to help unify some of the
* API for downstream classes.
*
*/
var BasePlot = /** @class */ (function () {
/**
* @param el - The DOM element to draw within (div, etc.)
* @param options - The ConstructorOptions for this plot.
*/
function BasePlot(el, options) {
if (options === void 0) { options = new constructor_options_1.ConstructorOptions(); }
this._plot = new sigplot.Plot(el, options.toInterface());
this._options = options;
}
Object.defineProperty(BasePlot.prototype, "settings", {
/**
* The settings related to the current plot. For use with checkSettings.
*/
get: function () {
return this._options;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BasePlot.prototype, "xlab", {
/**
* If your ConstructorOptions use the default xlabel and ylabel, changing
* these values will update the X and Y labels by getting the string name
* of the enumeration (Units).
*/
set: function (units) { this._options.xlab = units; },
enumerable: true,
configurable: true
});
Object.defineProperty(BasePlot.prototype, "ylab", {
set: function (units) { this._options.ylab = units; },
enumerable: true,
configurable: true
});
/**
* If you resize the DOM element for the plot, call this to cause the plot
* to redraw
*/
BasePlot.prototype.checkResize = function () { this._plot.checkresize(); };
/**
* Push any changes in the settings to the underlying plot instance.
*/
BasePlot.prototype.checkSettings = function () { this._plot.change_settings(this.settings.toInterface()); };
return BasePlot;
}());
exports.BasePlot = BasePlot;
//# sourceMappingURL=base-plot.js.map
;