UNPKG

@covalent/echarts

Version:

Teradata UI Platform Echarts Module

164 lines (159 loc) 7.89 kB
import * as i0 from '@angular/core'; import { forwardRef, Component, ChangeDetectionStrategy, Input, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import * as i1 from '@covalent/echarts/base'; import { assignDefined, TdSeriesDirective } from '@covalent/echarts/base'; import { TdChartSeriesScatterComponent } from '@covalent/echarts/scatter'; import * as ecStat from 'echarts-stat'; class TdChartSeriesRegressionComponent extends TdChartSeriesScatterComponent { constructor(_optionsService) { super(_optionsService); } ngOnChanges() { this.render(); } getConfig() { return { regressionType: this.regressionType, polinomialOrder: this.polinomialOrder, coordinateSystem: this.coordinateSystem, xAxisIndex: this.xAxisIndex, yAxisIndex: this.yAxisIndex, polarIndex: this.polarIndex, geoIndex: this.geoIndex, calendarIndex: this.calendarIndex, hoverAnimation: this.hoverAnimation, legendHoverLink: this.legendHoverLink, symbol: this.symbol, symbolSize: this.symbolSize, symbolRotate: this.symbolRotate, symbolKeepAspect: this.symbolKeepAspect, symbolOffset: this.symbolOffset, large: this.large, largeThreshold: this.largeThreshold, cursor: this.cursor, label: this.label, itemStyle: this.itemStyle, emphasis: this.emphasis, progressive: this.progressive, progressiveThreshold: this.progressiveThreshold, dimensions: this.dimensions, encode: this.encode, seriesLayoutBy: this.seriesLayoutBy, datasetIndex: this.datasetIndex, markPoint: this.markPoint, markLine: this.markLine, markArea: this.markArea, zlevel: this.zlevel, z: this.z, silent: this.silent, }; } setOptions() { const config = assignDefined(this._state, { id: this.id, type: this.type, name: this.name, color: this.color, data: this.data, animation: this.animation, animationThreshold: this.animationThreshold, animationDuration: this.animationDuration, animationEasing: this.animationEasing, animationDelay: this.animationDelay, animationDurationUpdate: this.animationDurationUpdate, animationEasingUpdate: this.animationEasingUpdate, animationDelayUpdate: this.animationDelayUpdate, tooltip: this.tooltip, }, this.getConfig(), this._options, this.config ? this.config : {}); this.optionsService.setArrayOption('scatter', config); } render() { var _a, _b; const output = this.data; const result = ecStat.regression((_a = this.regressionType) !== null && _a !== void 0 ? _a : 'linear', output, (_b = this.polinomialOrder) !== null && _b !== void 0 ? _b : 2); let series = this.optionsService.getOption('series'); if (series) { for (const item in series) { if (series[item].type === 'line') { delete series[item]; } } } else { series = []; } series.push({ type: 'line', data: result.points, tooltip: {}, showSymbol: false, }); this.optionsService.setOption('series', series); this.setOptions(); } } TdChartSeriesRegressionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartSeriesRegressionComponent, deps: [{ token: i1.TdChartOptionsService }], target: i0.ɵɵFactoryTarget.Component }); TdChartSeriesRegressionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TdChartSeriesRegressionComponent, selector: "td-chart-series[td-regression]", inputs: { config: "config", id: "id", name: "name", color: "color", data: "data", animation: "animation", animationThreshold: "animationThreshold", animationDuration: "animationDuration", animationEasing: "animationEasing", animationDelay: "animationDelay", animationDurationUpdate: "animationDurationUpdate", animationEasingUpdate: "animationEasingUpdate", animationDelayUpdate: "animationDelayUpdate", tooltip: "tooltip", regressionType: "regressionType", polinomialOrder: "polinomialOrder" }, providers: [ { provide: TdSeriesDirective, useExisting: forwardRef(() => TdChartSeriesRegressionComponent), }, ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdChartSeriesRegressionComponent, decorators: [{ type: Component, args: [{ selector: 'td-chart-series[td-regression]', template: '', changeDetection: ChangeDetectionStrategy.OnPush, inputs: [ 'config', 'id', 'name', 'color', 'data', 'animation', 'animationThreshold', 'animationDuration', 'animationEasing', 'animationDelay', 'animationDurationUpdate', 'animationEasingUpdate', 'animationDelayUpdate', 'tooltip', ], providers: [ { provide: TdSeriesDirective, useExisting: forwardRef(() => TdChartSeriesRegressionComponent), }, ], }] }], ctorParameters: function () { return [{ type: i1.TdChartOptionsService }]; }, propDecorators: { data: [{ type: Input }], regressionType: [{ type: Input }], polinomialOrder: [{ type: Input }] } }); const REGRESSION_MODULE_COMPONENTS = [ TdChartSeriesRegressionComponent, ]; class CovalentRegressionEchartsModule { } CovalentRegressionEchartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentRegressionEchartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); CovalentRegressionEchartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CovalentRegressionEchartsModule, declarations: [TdChartSeriesRegressionComponent], imports: [CommonModule], exports: [TdChartSeriesRegressionComponent] }); CovalentRegressionEchartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentRegressionEchartsModule, imports: [CommonModule] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentRegressionEchartsModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule], declarations: [REGRESSION_MODULE_COMPONENTS], exports: [REGRESSION_MODULE_COMPONENTS], }] }] }); /** * Generated bundle index. Do not edit. */ export { CovalentRegressionEchartsModule, REGRESSION_MODULE_COMPONENTS, TdChartSeriesRegressionComponent }; //# sourceMappingURL=covalent-echarts-regression.mjs.map