scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
79 lines (78 loc) • 4.66 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FastLineSegmentRenderableSeries = void 0;
var SeriesType_1 = require("../../../types/SeriesType");
var BasePointSeriesWrapped_1 = require("../../Model/PointSeries/BasePointSeriesWrapped");
var BaseLineRenderableSeries_1 = require("./BaseLineRenderableSeries");
var LineSeriesDataLabelProvider_1 = require("./DataLabels/LineSeriesDataLabelProvider");
var LineSegmentSeriesDrawingProvider_1 = require("./DrawingProviders/LineSegmentSeriesDrawingProvider");
var PointMarkerDrawingProvider_1 = require("./DrawingProviders/PointMarkerDrawingProvider");
var LineSegmentSeriesHitTestProvider_1 = require("./HitTest/LineSegmentSeriesHitTestProvider");
/**
* Defines a line-series or line chart type in the SciChart's High Performance Real-time
* {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}
* @remarks
* To add a line series to a {@link SciChartSurface} you need to declare both the {@link FastLineSegmentRenderableSeries | RenderableSeries}
* and a {@link XyDataSeries | DataSeries}. Simplified code sample below:
*
* ---
* 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/fast-line-segment-renderable-series/}
*/
var FastLineSegmentRenderableSeries = /** @class */ (function (_super) {
__extends(FastLineSegmentRenderableSeries, _super);
/**
* Creates an instance of the {@link FastLineSegmentRenderableSeries}
* @param webAssemblyContext The {@link TSciChart | SciChart WebAssembly Context} containing
* native methods and access to our WebGL2 WebAssembly Drawing Engine
* @param options optional parameters of type {@link IFastLineSegmentRenderableSeriesOptions} applied when constructing the series type
*
* ---
* 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/fast-line-segment-renderable-series/}
*/
function FastLineSegmentRenderableSeries(webAssemblyContext, options) {
var _this = this;
var _a, _b;
_this = _super.call(this, webAssemblyContext, options) || this;
_this.type = SeriesType_1.ESeriesType.LineSegmentSeries;
if (!_this.dataLabelProviderProperty) {
_this.dataLabelProviderProperty = new LineSeriesDataLabelProvider_1.LineSeriesDataLabelProvider(options === null || options === void 0 ? void 0 : options.dataLabels);
_this.dataLabelProviderProperty.onAttach(_this.webAssemblyContext, _this);
}
// Must be called here for the series type to be available
if ((_a = _this.paletteProvider) === null || _a === void 0 ? void 0 : _a.onAttached) {
(_b = _this.paletteProvider) === null || _b === void 0 ? void 0 : _b.onAttached(_this);
}
return _this;
}
/** @inheritDoc */
FastLineSegmentRenderableSeries.prototype.toPointSeries = function (rp) {
return new BasePointSeriesWrapped_1.BasePointSeriesWrapped(this.dataSeries);
};
FastLineSegmentRenderableSeries.prototype.addDrawingProviders = function (webAssemblyContext, options) {
this.drawingProviders.push(new LineSegmentSeriesDrawingProvider_1.LineSegmentSeriesDrawingProvider(webAssemblyContext, this));
this.drawingProviders.push(new PointMarkerDrawingProvider_1.PointMarkerDrawingProvider(webAssemblyContext, this));
};
/**
* @inheritDoc
*/
FastLineSegmentRenderableSeries.prototype.newHitTestProvider = function () {
return new LineSegmentSeriesHitTestProvider_1.LineSegmentSeriesHitTestProvider(this, this.webAssemblyContext);
};
return FastLineSegmentRenderableSeries;
}(BaseLineRenderableSeries_1.BaseLineRenderableSeries));
exports.FastLineSegmentRenderableSeries = FastLineSegmentRenderableSeries;