UNPKG

scichart

Version:

Fast WebGL JavaScript Charting Library and Framework

175 lines (174 loc) 9.22 kB
"use strict"; 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.PolarBandRenderableSeries = void 0; var __1 = require("../../../.."); var SeriesType_1 = require("../../../../types/SeriesType"); var BaseBandRenderableSeries_1 = require("../BaseBandRenderableSeries"); var BaseLineRenderableSeries_1 = require("../BaseLineRenderableSeries"); var PolarInterpolateBandRenderDataTransform_1 = require("../RenderDataTransforms/PolarInterpolateBandRenderDataTransform"); var PolarBandSeriesDrawingProvider_1 = require("./DrawingProviders/PolarBandSeriesDrawingProvider"); var PolarLineSeriesDrawingProvider_1 = require("./DrawingProviders/PolarLineSeriesDrawingProvider"); var PolarPointMarkerDrawingProvider_1 = require("./DrawingProviders/PolarPointMarkerDrawingProvider"); /** * Defines a JavaScript Polar Band-series or High-Low polygon fill chart type in the SciChart's High Performance Real-time * {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts} * @remarks * To add a polar band series to a {@link SciChartPolarSurface} you need to declare both the {@link PolarBandRenderableSeries} * and a {@link XyyDataSeries}. Simplified code sample below: * * ```ts * const { sciChartSurface, wasmContext } = SciChartPolarSurface.create(rootId); * * // Create the renderableSeries * const polarBandSeries = new PolarBandRenderableSeries(wasmContext, { * dataSeries: new XyyDataSeries(wasmContext, { * xValues: [1, 2, 3], * yValues: [3, 2, 4], * y1Values: [3, 4, 3] * }), * stroke: "#FFF" * }); * // append to the SciChartSurface * sciChartPolarSurface.renderableSeries.add(polarBandSeries); * ``` * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/polar-band-renderable-series/} */ var PolarBandRenderableSeries = /** @class */ (function (_super) { __extends(PolarBandRenderableSeries, _super); /** * Creates an instance of the {@link PolarBandRenderableSeries} * @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 IPolarBandRenderableSeriesOptions} applied when constructing the series type * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/polar-band-renderable-series/} */ function PolarBandRenderableSeries(webAssemblyContext, options) { var _this = this; var _a, _b, _c, _d; _this = _super.call(this, webAssemblyContext, options) || this; _this.isPolar = true; _this.type = SeriesType_1.ESeriesType.PolarBandSeries; _this.lineType = BaseLineRenderableSeries_1.ELineType.Normal; _this.clipToTotalAngle = false; _this.interpolateLineProperty = false; _this.renderDataTransformProperty = new PolarInterpolateBandRenderDataTransform_1.PolarInterpolateBandRenderDataTransform(_this, _this.webAssemblyContext, []); _this.interpolateLine = (_a = options === null || options === void 0 ? void 0 : options.interpolateLine) !== null && _a !== void 0 ? _a : _this.interpolateLineProperty; _this.scaleGradientToYRangeProperty = (_b = options === null || options === void 0 ? void 0 : options.scaleGradientToYRange) !== null && _b !== void 0 ? _b : _this.scaleGradientToYRangeProperty; // Must be called here for the series type to be available if ((_c = _this.paletteProvider) === null || _c === void 0 ? void 0 : _c.onAttached) { (_d = _this.paletteProvider) === null || _d === void 0 ? void 0 : _d.onAttached(_this); } return _this; } Object.defineProperty(PolarBandRenderableSeries.prototype, "isDigitalLine", { /** @inheritDoc */ get: function () { return false; }, enumerable: false, configurable: true }); Object.defineProperty(PolarBandRenderableSeries.prototype, "scaleGradientToYRange", { /** * Gets or sets the flag to scale gradient along the Y data-range. For Y Radial axis if False gradient starts at the circle center * and ends at the the circle edge. However, if True the gradient starts at min Y value and ends and max Y value for every arc segment. */ get: function () { return this.scaleGradientToYRangeProperty; }, set: function (value) { if (this.scaleGradientToYRangeProperty !== value) { this.scaleGradientToYRangeProperty = value; this.notifyPropertyChanged("SCALE_GRADIENT_TO_Y_RANGE"); } }, enumerable: false, configurable: true }); Object.defineProperty(PolarBandRenderableSeries.prototype, "interpolateLine", { /** * Gets or sets the interpolation flag for line segments. If False each line segment draws normally. * If True each line segment draws as an arc. */ get: function () { return this.interpolateLineProperty; }, set: function (value) { if (this.interpolateLineProperty !== value) { this.interpolateLineProperty = value; if (this.interpolateLineProperty) { this.renderDataTransform.drawingProviders = this.drawingProviders; } else { this.renderDataTransform.drawingProviders = []; } this.notifyPropertyChanged("interpolateLine"); } }, enumerable: false, configurable: true }); /** @inheritDoc */ PolarBandRenderableSeries.prototype.getIndicesRange = function (xRange, isCategoryData) { if (this.clipToTotalAngle) { return _super.prototype.getIndicesRange.call(this, xRange, isCategoryData); } else { return new __1.NumberRange(0, this.dataSeries.count() - 1); } }; /** @inheritDoc */ PolarBandRenderableSeries.prototype.toJSON = function (excludeData) { if (excludeData === void 0) { excludeData = false; } var json = _super.prototype.toJSON.call(this, excludeData); var options = { scaleGradientToYRange: this.scaleGradientToYRange, interpolateLine: this.interpolateLine }; Object.assign(json.options, options); return json; }; /** @inheritDoc */ PolarBandRenderableSeries.prototype.addDrawingProviders = function (webAssemblyContext, options) { this.drawingProviders.push(new PolarBandSeriesDrawingProvider_1.PolarBandSeriesDrawingProvider(webAssemblyContext, this)); this.drawingProviders.push(new PolarLineSeriesDrawingProvider_1.PolarLineSeriesDrawingProvider(webAssemblyContext, this)); var y1LineDP = new PolarLineSeriesDrawingProvider_1.PolarLineSeriesDrawingProvider(webAssemblyContext, this, function (ps) { return ps.y1Values; }); y1LineDP.getProperties = function (parentSeries) { var _a = parentSeries, strokeY1 = _a.strokeY1, strokeThickness = _a.strokeThickness, opacity = _a.opacity, strokeY1DashArray = _a.strokeY1DashArray, isDigitalLine = _a.isDigitalLine, drawNaNAs = _a.drawNaNAs, lineType = _a.lineType; return { stroke: strokeY1, strokeThickness: strokeThickness, opacity: opacity, strokeDashArray: strokeY1DashArray, isDigitalLine: isDigitalLine, drawNaNAs: drawNaNAs, lineType: lineType, containsNaN: undefined }; }; this.drawingProviders.push(y1LineDP); this.drawingProviders.push(new PolarPointMarkerDrawingProvider_1.PolarPointMarkerDrawingProvider(webAssemblyContext, this)); this.drawingProviders.push(new PolarPointMarkerDrawingProvider_1.PolarPointMarkerDrawingProvider(webAssemblyContext, this, function (ps) { return ps.y1Values; }, undefined)); }; return PolarBandRenderableSeries; }(BaseBandRenderableSeries_1.BaseBandRenderableSeries)); exports.PolarBandRenderableSeries = PolarBandRenderableSeries;