igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
111 lines (110 loc) • 5.48 kB
JavaScript
import { EventEmitter, Output, Component, forwardRef, ChangeDetectionStrategy } from '@angular/core';
import { IgxStrategyBasedIndicatorComponent } from './igx-strategy-based-indicator-component';
import { IgxFinancialIndicatorComponent } from './igx-financial-indicator-component';
import { IgxFinancialSeriesComponent } from './igx-financial-series-component';
import { IgxSeriesComponent } from './igx-series-component';
import { CustomIndicator } from "./CustomIndicator";
import { IgxFinancialEventArgs } from "./igx-financial-event-args";
import { delegateCombine } from "igniteui-angular-core";
import * as i0 from "@angular/core";
/**
* Represents a IgxDataChartComponent Custom Indicator series.
* The indicator value is calculated in the user specified Indicator event handler.
*
* `CustomIndicator` class specify the series as Custom Indicator series.
*
* ```html
* <igx-data-chart [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="time">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-commodity-channel-index-indicator
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume" >
* </igx-commodity-channel-index-indicator>
* </igx-data-chart>
* ```
*
* ```ts
* let series = new IgxCustomIndicatorComponent();
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.openMemberPath = "open";
* series.highMemberPath = "high";
* series.lowMemberPath = "low";
* series.closeMemberPath = "close";
* this.chart.series.add(series);
* ```
*/
export let IgxCustomIndicatorComponent = /*@__PURE__*/ (() => {
class IgxCustomIndicatorComponent extends IgxStrategyBasedIndicatorComponent {
constructor() {
super();
this._indicator = null;
this._basedOnColumns = null;
}
createImplementation() {
return new CustomIndicator();
}
get i() {
return this._implementation;
}
/**
* This event is raised when the indicator values need to be computed.
*/
get indicator() {
if (this._indicator == null) {
this._indicator = new EventEmitter();
this.i.indicator = delegateCombine(this.i.indicator, (o, e) => {
let outerArgs = new IgxFinancialEventArgs();
outerArgs._provideImplementation(e);
this._indicator.emit({
sender: this,
args: outerArgs
});
});
}
return this._indicator;
}
/**
* This event is raised when the based on columns to be specified.
*/
get basedOnColumns() {
if (this._basedOnColumns == null) {
this._basedOnColumns = new EventEmitter();
this.i.basedOnColumns = delegateCombine(this.i.indicator, (o, e) => {
let outerArgs = new IgxFinancialEventArgs();
outerArgs._provideImplementation(e);
this._basedOnColumns.emit({
sender: this,
args: outerArgs
});
});
}
return this._indicator;
}
}
IgxCustomIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxCustomIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
IgxCustomIndicatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxCustomIndicatorComponent, selector: "igx-custom-indicator", outputs: { indicator: "indicator", basedOnColumns: "basedOnColumns" }, providers: [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }], usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxCustomIndicatorComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxCustomIndicatorComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-custom-indicator',
template: ``,
providers: [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }],
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: function () { return []; }, propDecorators: { indicator: [{
type: Output
}], basedOnColumns: [{
type: Output
}] } });