UNPKG

scichart

Version:

Fast WebGL JavaScript Charting Library and Framework

166 lines (165 loc) 8.74 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.FastTriangleRenderableSeries = void 0; var SeriesType_1 = require("../../../types/SeriesType"); var TriangleSeriesDrawMode_1 = require("../../../types/TriangleSeriesDrawMode"); var IThemeProvider_1 = require("../../Themes/IThemeProvider"); var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase"); var BaseRenderableSeries_1 = require("./BaseRenderableSeries"); var constants_1 = require("./constants"); var LineSeriesDataLabelProvider_1 = require("./DataLabels/LineSeriesDataLabelProvider"); var PointMarkerDrawingProvider_1 = require("./DrawingProviders/PointMarkerDrawingProvider"); var TriangleSeriesDrawingProvider_1 = require("./DrawingProviders/TriangleSeriesDrawingProvider"); var TriangleSeriesHitTestProvider_1 = require("./HitTest/TriangleSeriesHitTestProvider"); var TriangleSeriesInfo_1 = require("../../Model/ChartData/TriangleSeriesInfo"); /** * The FastTriangleRenderableSeries is a specialized renderable series for displaying triangles in SciChart's High Performance Real-time * {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts} * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/fast-triangle-renderable-series/} */ var FastTriangleRenderableSeries = /** @class */ (function (_super) { __extends(FastTriangleRenderableSeries, _super); function FastTriangleRenderableSeries(webAssemblyContext, options) { var _this = this; var _a, _b, _c; _this = _super.call(this, webAssemblyContext, options) || this; _this.type = SeriesType_1.ESeriesType.TriangleSeries; _this.drawModeProperty = TriangleSeriesDrawMode_1.ETriangleSeriesDrawMode.List; _this.polygonVerticesProperty = 0; _this.fillProperty = SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.columnFillBrush; if (!_this.dataLabelProviderProperty) { _this.dataLabelProviderProperty = new LineSeriesDataLabelProvider_1.LineSeriesDataLabelProvider(options === null || options === void 0 ? void 0 : options.dataLabels); _this.dataLabelProviderProperty.onAttach(_this.webAssemblyContext, _this); } _this.drawModeProperty = (_a = options === null || options === void 0 ? void 0 : options.drawMode) !== null && _a !== void 0 ? _a : _this.drawModeProperty; _this.polygonVerticesProperty = (_b = options === null || options === void 0 ? void 0 : options.polygonVertices) !== null && _b !== void 0 ? _b : _this.polygonVerticesProperty; _this.fillProperty = (_c = options === null || options === void 0 ? void 0 : options.fill) !== null && _c !== void 0 ? _c : _this.fillProperty; _this.fillLinearGradientProperty = options === null || options === void 0 ? void 0 : options.fillLinearGradient; _this.customTextureOptionsProperty = options === null || options === void 0 ? void 0 : options.customTextureOptions; return _this; } FastTriangleRenderableSeries.prototype.addDrawingProviders = function (webAssemblyContext, options) { this.drawingProviders.push(new TriangleSeriesDrawingProvider_1.TriangleSeriesDrawingProvider(webAssemblyContext, this)); this.drawingProviders.push(new PointMarkerDrawingProvider_1.PointMarkerDrawingProvider(webAssemblyContext, this)); }; Object.defineProperty(FastTriangleRenderableSeries.prototype, "drawMode", { get: function () { return this.drawModeProperty; }, set: function (value) { this.drawModeProperty = value; this.notifyPropertyChanged(constants_1.PROPERTY.TRIANGLE_DRAW_MODE); }, enumerable: false, configurable: true }); Object.defineProperty(FastTriangleRenderableSeries.prototype, "polygonVertices", { get: function () { return this.polygonVerticesProperty; }, set: function (value) { this.polygonVerticesProperty = value; this.notifyPropertyChanged(constants_1.PROPERTY.POLYGON_VERTICES); }, enumerable: false, configurable: true }); Object.defineProperty(FastTriangleRenderableSeries.prototype, "fill", { get: function () { return (0, IThemeProvider_1.stripAutoColor)(this.fillProperty); }, set: function (htmlColorCode) { this.fillProperty = htmlColorCode; this.notifyPropertyChanged(constants_1.PROPERTY.FILL); }, enumerable: false, configurable: true }); Object.defineProperty(FastTriangleRenderableSeries.prototype, "fillLinearGradient", { /** * Gets or sets the fill as a gradient brush */ get: function () { return this.fillLinearGradientProperty; }, /** * Gets or sets the fill as a gradient brush */ set: function (gradientBrushParams) { // We need this check, to prevent creating new Texture if we set the same value if (gradientBrushParams !== this.fillLinearGradientProperty) { this.fillLinearGradientProperty = gradientBrushParams; this.notifyPropertyChanged(constants_1.PROPERTY.FILL_LINEAR_GRADIENT); } }, enumerable: false, configurable: true }); Object.defineProperty(FastTriangleRenderableSeries.prototype, "customTextureOptions", { /** * Gets or sets options to use a custom texture brush */ get: function () { return this.customTextureOptionsProperty; }, /** * Gets or sets options to use a custom texture brush */ set: function (customTextureOptions) { // We need this check, to prevent creating new Texture if we set the same value if (customTextureOptions !== this.customTextureOptionsProperty) { this.customTextureOptionsProperty = customTextureOptions; this.notifyPropertyChanged(constants_1.PROPERTY.CUSTOM_TEXTURE_OPTIONS); } }, enumerable: false, configurable: true }); FastTriangleRenderableSeries.prototype.resolveAutoColors = function (index, maxSeries, theme) { _super.prototype.resolveAutoColors.call(this, index, maxSeries, theme); if (this.fillProperty.startsWith(IThemeProvider_1.AUTO_COLOR)) { var color = theme.getFillColor(index, maxSeries, this.webAssemblyContext); this.fill = IThemeProvider_1.AUTO_COLOR + this.adjustAutoColor("fill", color); } }; /** @inheritDoc */ FastTriangleRenderableSeries.prototype.getSeriesInfo = function (hitTestInfo) { return new TriangleSeriesInfo_1.TriangleSeriesInfo(this, hitTestInfo, this.drawMode, this.polygonVertices); }; /** @inheritDoc */ FastTriangleRenderableSeries.prototype.toJSON = function (excludeData) { if (excludeData === void 0) { excludeData = false; } var json = _super.prototype.toJSON.call(this, excludeData); var options = { fill: this.fill, drawMode: this.drawMode, polygonVertices: this.polygonVertices, customTextureOptions: this.customTextureOptions, fillLinearGradient: this.fillLinearGradient }; Object.assign(json.options, options); return json; }; FastTriangleRenderableSeries.prototype.newHitTestProvider = function () { return new TriangleSeriesHitTestProvider_1.TriangleSeriesHitTestProvider(this, this.webAssemblyContext); }; return FastTriangleRenderableSeries; }(BaseRenderableSeries_1.BaseRenderableSeries)); exports.FastTriangleRenderableSeries = FastTriangleRenderableSeries;