{"version":3,"file":"covalent-echarts-regression.mjs","sources":["../../../../libs/angular-echarts/regression/src/regression.component.ts","../../../../libs/angular-echarts/regression/src/regression.module.ts","../../../../libs/angular-echarts/regression/src/covalent-echarts-regression.ts"],"sourcesContent":["import {\n  Component,\n  Input,\n  ChangeDetectionStrategy,\n  forwardRef,\n  OnChanges,\n} from '@angular/core';\n\nimport {\n  assignDefined,\n  TdChartOptionsService,\n  TdSeriesDirective,\n} from '@covalent/echarts/base';\nimport {\n  ITdScatterSeries,\n  TdChartSeriesScatterComponent,\n} from '@covalent/echarts/scatter';\nimport * as ecStat from 'echarts-stat';\n\nexport type TdRegressionType =\n  | 'linear'\n  | 'exponential'\n  | 'logarithmic'\n  | 'polynomial';\n\nexport interface ITdRegressionSeries extends ITdScatterSeries {\n  data?: number[][];\n  regressionType?: TdRegressionType;\n  polinomialOrder?: number;\n}\n\n@Component({\n  selector: 'td-chart-series[td-regression]',\n  template: '',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  inputs: [\n    'config',\n    'id',\n    'name',\n    'color',\n    'data',\n\n    'animation',\n    'animationThreshold',\n    'animationDuration',\n    'animationEasing',\n    'animationDelay',\n    'animationDurationUpdate',\n    'animationEasingUpdate',\n    'animationDelayUpdate',\n    'tooltip',\n  ],\n  providers: [\n    {\n      provide: TdSeriesDirective,\n      useExisting: forwardRef(() => TdChartSeriesRegressionComponent),\n    },\n  ],\n})\nexport class TdChartSeriesRegressionComponent\n  extends TdChartSeriesScatterComponent\n  implements ITdRegressionSeries, OnChanges\n{\n  @Input() declare data?: number[][];\n  @Input() regressionType?: TdRegressionType;\n  @Input() polinomialOrder?: number;\n\n  constructor(_optionsService: TdChartOptionsService) {\n    super(_optionsService);\n  }\n\n  override ngOnChanges(): void {\n    this.render();\n  }\n\n  override getConfig(): any {\n    return {\n      regressionType: this.regressionType,\n      polinomialOrder: this.polinomialOrder,\n      coordinateSystem: this.coordinateSystem,\n      xAxisIndex: this.xAxisIndex,\n      yAxisIndex: this.yAxisIndex,\n      polarIndex: this.polarIndex,\n      geoIndex: this.geoIndex,\n      calendarIndex: this.calendarIndex,\n      hoverAnimation: this.hoverAnimation,\n      legendHoverLink: this.legendHoverLink,\n      symbol: this.symbol,\n      symbolSize: this.symbolSize,\n      symbolRotate: this.symbolRotate,\n      symbolKeepAspect: this.symbolKeepAspect,\n      symbolOffset: this.symbolOffset,\n      large: this.large,\n      largeThreshold: this.largeThreshold,\n      cursor: this.cursor,\n      label: this.label,\n      itemStyle: this.itemStyle,\n      emphasis: this.emphasis,\n      progressive: this.progressive,\n      progressiveThreshold: this.progressiveThreshold,\n      dimensions: this.dimensions,\n      encode: this.encode,\n      seriesLayoutBy: this.seriesLayoutBy,\n      datasetIndex: this.datasetIndex,\n      markPoint: this.markPoint,\n      markLine: this.markLine,\n      markArea: this.markArea,\n      zlevel: this.zlevel,\n      z: this.z,\n      silent: this.silent,\n    };\n  }\n\n  private setOptions(): void {\n    const config: any = assignDefined(\n      this._state,\n      {\n        id: this.id,\n        type: this.type,\n        name: this.name,\n        color: this.color,\n        data: this.data,\n        animation: this.animation,\n        animationThreshold: this.animationThreshold,\n        animationDuration: this.animationDuration,\n        animationEasing: this.animationEasing,\n        animationDelay: this.animationDelay,\n        animationDurationUpdate: this.animationDurationUpdate,\n        animationEasingUpdate: this.animationEasingUpdate,\n        animationDelayUpdate: this.animationDelayUpdate,\n        tooltip: this.tooltip,\n      },\n      this.getConfig(),\n      this._options,\n      this.config ? this.config : {}\n    );\n    this.optionsService.setArrayOption('scatter', config);\n  }\n\n  private render() {\n    const output: any = this.data;\n    const result = ecStat.regression(\n      this.regressionType ?? 'linear',\n      output,\n      this.polinomialOrder ?? 2\n    );\n    let series = this.optionsService.getOption('series');\n\n    if (series) {\n      for (const item in series) {\n        if (series[item].type === 'line') {\n          delete series[item];\n        }\n      }\n    } else {\n      series = [];\n    }\n\n    series.push({\n      type: 'line',\n      data: result.points,\n      tooltip: {},\n      showSymbol: false,\n    });\n\n    this.optionsService.setOption('series', series);\n    this.setOptions();\n  }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { TdChartSeriesRegressionComponent } from './regression.component';\n\nexport const REGRESSION_MODULE_COMPONENTS: Type<any>[] = [\n  TdChartSeriesRegressionComponent,\n];\n\n/**\n * @deprecated This module is deprecated and will be removed in future versions.\n * Please migrate to using standalone components as soon as possible.\n */\n@NgModule({\n  imports: [REGRESSION_MODULE_COMPONENTS],\n  exports: [REGRESSION_MODULE_COMPONENTS],\n})\nexport class CovalentRegressionEchartsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AA2DM,MAAO,gCACX,SAAQ,6BAA6B,CAAA;AAGpB,IAAA,IAAI;AACZ,IAAA,cAAc;AACd,IAAA,eAAe;AAExB,IAAA,WAAA,CAAY,eAAsC,EAAA;QAChD,KAAK,CAAC,eAAe,CAAC;;IAGf,WAAW,GAAA;QAClB,IAAI,CAAC,MAAM,EAAE;;IAGN,SAAS,GAAA;QAChB,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK,EAAE,IAAI,CAAC,KA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