igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
522 lines (517 loc) • 19.7 kB
JavaScript
import { Component, forwardRef, Input, ChangeDetectionStrategy } from '@angular/core';
import { TrendLineType_$type } from "igniteui-angular-core";
import { PriceDisplayType_$type } from "./PriceDisplayType";
import { CategoryCollisionMode_$type } from "./CategoryCollisionMode";
import { ValueLayerValueMode_$type } from "./ValueLayerValueMode";
import { IgxFinancialSeriesComponent } from "./igx-financial-series-component";
import { IgxSeriesComponent } from "./igx-series-component";
import { FinancialPriceSeries } from "./FinancialPriceSeries";
import { ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromRect, fromPoint } from "igniteui-angular-core";
import * as i0 from "@angular/core";
/**
* Represents a IgxDataChartComponent financial price series that renders as Candlestick or OHLC representations.
* Default required members: Open, Low, High, Close
*
* The `FinancialPriceSeries` class represents a IgxDataChartComponent financial price series that renders as Candlestick or OHLC representations.
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* >
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*
* ```ts
* let series = new IgxFinancialPriceSeriesComponent();
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.openMemberPath = "open";
* series.highMemberPath = "high";
* series.lowMemberPath = "low";
* series.closeMemberPath = "close";
* series.volumeMemberPath="volume";
* this.chart.series.add(series);
* ```
*/
export let IgxFinancialPriceSeriesComponent = /*@__PURE__*/ (() => {
class IgxFinancialPriceSeriesComponent extends IgxFinancialSeriesComponent {
constructor() {
super();
}
createImplementation() {
return new FinancialPriceSeries();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets whether the series has financial OHLC/candlestick visuals
*/
get isFinancialSeries() {
return this.i.fd;
}
/**
* Gets or sets the trend type for the current financial series.
*
* Use the `TrendLineType` property for the trend type of the current financial series.
*
* ```ts
* series.trendLineType= "CubicFit";
* ```
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* trendLineType="CubicFit">
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*/
get trendLineType() {
return this.i.trendLineType;
}
set trendLineType(v) {
this.i.trendLineType = ensureEnum(TrendLineType_$type, v);
}
/**
* Gets or sets the brush to use to draw the trend line.
*
* Use the `TrendLineBrush` property to brush the the trend line.
*
* ```ts
* series.trendLineBrush="red";
* ```
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* trendLineBrush="red" >
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*/
get trendLineBrush() {
return brushToString(this.i.trendLineBrush);
}
set trendLineBrush(v) {
this.i.trendLineBrush = stringToBrush(v);
}
/**
* Gets the effective TrendLineBrush for this FinancialPriceSeries.
*
* Use the `ActualTrendLineBrush` property to Gets the effective TrendLineBrush for the FinancialIndicator.
*/
get actualTrendLineBrush() {
return brushToString(this.i.ac5);
}
set actualTrendLineBrush(v) {
this.i.ac5 = stringToBrush(v);
}
/**
* Gets or sets the thickness of the current FinancialPriceSeries object's trend line.
*
* Use the `TrendLineThickness` property for the thickness of the current FinancialPriceSeries object's trend line.
*
* ```ts
* series.trendLineThickness=5;
* ```
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* trendLineThickness="3">
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*/
get trendLineThickness() {
return this.i.trendLineThickness;
}
set trendLineThickness(v) {
this.i.trendLineThickness = +v;
}
/**
* Gets or sets a collection of double values that indicate the pattern of dashes and gaps that
* is used to draw the trend line for the current FinancialPriceSeries object.
*/
get trendLineDashArray() {
return fromDoubleCollection(this.i.ac7);
}
set trendLineDashArray(v) {
this.i.ac7 = toDoubleCollection(v);
}
/**
* Gets or sets the trend line period for the current series.
* The typical, and initial, value for trend line period is 7.
*
* Use the `TrendLinePeriod` property for the periodo the the current series.
*
* ```ts
* series.trendLinePeriod= 7;
* ```
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* trendLinePeriod="7">
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*/
get trendLinePeriod() {
return this.i.trendLinePeriod;
}
set trendLinePeriod(v) {
this.i.trendLinePeriod = +v;
}
/**
* Gets or sets the display type for the current FinancialPriceSeries object.
*
* Use the `DisplayType` property for the display type of the current FinancialPriceSeries object.
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* displayType="Candlestick">
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*
* ```ts
* series.displayType=PriceDisplayType.Candlestick;
* ```
*/
get displayType() {
return this.i.abn;
}
set displayType(v) {
this.i.abn = ensureEnum(PriceDisplayType_$type, v);
}
/**
* Gets or sets the category collision mode selection behavior to use for the series.
*/
get categoryCollisionMode() {
return this.i.abl;
}
set categoryCollisionMode(v) {
this.i.abl = ensureEnum(CategoryCollisionMode_$type, v);
}
/**
* Brush to use for outlining negative elements in the series.
*
* Use the `NegativeOutline` property to brush the outline negative elements in the series.
*
* ```ts
* series.negativeOutline="red";
* ```
*
* ```html
* <igx-data-chart
* #chart
* [dataSource]="data" >
* <igx-ordinal-time-x-axis
* dateTimeMemberPath="TimeStamp"
* #xAxis >
* </igx-ordinal-time-x-axis>
* <igx-numeric-y-axis
* minimumValue="0"
* #yAxis>
* </igx-numeric-y-axis>
* <igx-financial-price-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* openMemberPath="open"
* highMemberPath="high"
* lowMemberPath="low"
* closeMemberPath="close"
* volumeMemberPath="volume"
* negativeOutline="Red" >
* </igx-financial-price-series>
* </igx-data-chart>
* ```
*/
get negativeOutline() {
return brushToString(this.i.ac6);
}
set negativeOutline(v) {
this.i.ac6 = stringToBrush(v);
}
/**
* Gets or sets the label displayed before series' Low value in the Data Legend.
*/
get lowMemberAsLegendLabel() {
return this.i.ab4;
}
set lowMemberAsLegendLabel(v) {
this.i.ab4 = v;
}
/**
* Gets or sets the label displayed before series' High value in the Data Legend.
*/
get highMemberAsLegendLabel() {
return this.i.ab0;
}
set highMemberAsLegendLabel(v) {
this.i.ab0 = v;
}
/**
* Gets or sets the label displayed before series' Close value in the Data Legend.
*/
get closeMemberAsLegendLabel() {
return this.i.abv;
}
set closeMemberAsLegendLabel(v) {
this.i.abv = v;
}
/**
* Gets or sets the label displayed before series' Open value in the Data Legend.
*/
get openMemberAsLegendLabel() {
return this.i.ab9;
}
set openMemberAsLegendLabel(v) {
this.i.ab9 = v;
}
/**
* Gets or sets the unit displayed after series' Low value in the Data Legend.
*/
get lowMemberAsLegendUnit() {
return this.i.ab6;
}
set lowMemberAsLegendUnit(v) {
this.i.ab6 = v;
}
/**
* Gets or sets the unit displayed after series' High value in the Data Legend.
*/
get highMemberAsLegendUnit() {
return this.i.ab2;
}
set highMemberAsLegendUnit(v) {
this.i.ab2 = v;
}
/**
* Gets or sets the unit displayed after series' Close value in the Data Legend.
*/
get closeMemberAsLegendUnit() {
return this.i.abx;
}
set closeMemberAsLegendUnit(v) {
this.i.abx = v;
}
/**
* Gets or sets the unit displayed after series' Open value in the Data Legend.
*/
get openMemberAsLegendUnit() {
return this.i.acb;
}
set openMemberAsLegendUnit(v) {
this.i.acb = v;
}
/**
* If possible, will return the best available value bounding box within the series that has the best value match for the world position provided.
* @param world * The world coordinate for which to get a value bounding box for
*
* The `GetSeriesValueBoundingBox` method return the best available value bounding box within the series that has the best value match for the world position provided.
*/
getSeriesValueBoundingBox(world) {
let iv = this.i.w7(toPoint(world));
return fromRect(iv);
}
/**
* Scrolls the series to display the item for the specified data item.
* The categorySeries is scrolled by the minimum amount required to place the specified data item within
* the central 80% of the visible axis.
* @param item * The data item (item) to scroll to.
*
* The `ScrollIntoView` methos scrolls the series to display the item for the specified data item.
*/
scrollIntoView(item) {
let iv = this.i.gj(item);
return (iv);
}
/**
* For a category plotted series, returns the current width of the items within the categories. This only returns a value if the items have some form of width (e.g. columns, bars, etc.) otherwise 0 is returned.
*
* The `GetItemSpan` method is used For a category plotted series, returns the current width of the items within the categories.
*
* This only returns a value if the items have some form of width (e.g. columns, bars, etc.) otherwise 0 is returned
*/
getItemSpan() {
let iv = this.i.i3();
return (iv);
}
setNegativeColors(negativeBrush, negativeOutline) {
this.i.sk(stringToBrush(negativeBrush), stringToBrush(negativeOutline));
}
/**
* Gets a numeric value from the numeric axis associated with this series that matches the desired
* value mode.
* @param mode * The type of value desired from the series numeric axis.
*/
getSeriesValueType(mode) {
let iv = this.i.aq(ensureEnum(ValueLayerValueMode_$type, mode));
return (iv);
}
getSeriesValueTypePosition(mode) {
let iv = this.i.wy(ensureEnum(ValueLayerValueMode_$type, mode));
return fromPoint(iv);
}
getSeriesValueTypePositionFromValue(values) {
let iv = this.i.wz(values);
return fromPoint(iv);
}
}
IgxFinancialPriceSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxFinancialPriceSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
IgxFinancialPriceSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxFinancialPriceSeriesComponent, selector: "igx-financial-price-series", inputs: { trendLineType: "trendLineType", trendLineBrush: "trendLineBrush", actualTrendLineBrush: "actualTrendLineBrush", trendLineThickness: "trendLineThickness", trendLineDashArray: "trendLineDashArray", trendLinePeriod: "trendLinePeriod", displayType: "displayType", categoryCollisionMode: "categoryCollisionMode", negativeOutline: "negativeOutline", lowMemberAsLegendLabel: "lowMemberAsLegendLabel", highMemberAsLegendLabel: "highMemberAsLegendLabel", closeMemberAsLegendLabel: "closeMemberAsLegendLabel", openMemberAsLegendLabel: "openMemberAsLegendLabel", lowMemberAsLegendUnit: "lowMemberAsLegendUnit", highMemberAsLegendUnit: "highMemberAsLegendUnit", closeMemberAsLegendUnit: "closeMemberAsLegendUnit", openMemberAsLegendUnit: "openMemberAsLegendUnit" }, providers: [{ provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxFinancialPriceSeriesComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxFinancialPriceSeriesComponent) }], usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxFinancialPriceSeriesComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxFinancialPriceSeriesComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-financial-price-series',
template: ``,
providers: [{ provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxFinancialPriceSeriesComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxFinancialPriceSeriesComponent) }],
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: function () { return []; }, propDecorators: { trendLineType: [{
type: Input
}], trendLineBrush: [{
type: Input
}], actualTrendLineBrush: [{
type: Input
}], trendLineThickness: [{
type: Input
}], trendLineDashArray: [{
type: Input
}], trendLinePeriod: [{
type: Input
}], displayType: [{
type: Input
}], categoryCollisionMode: [{
type: Input
}], negativeOutline: [{
type: Input
}], lowMemberAsLegendLabel: [{
type: Input
}], highMemberAsLegendLabel: [{
type: Input
}], closeMemberAsLegendLabel: [{
type: Input
}], openMemberAsLegendLabel: [{
type: Input
}], lowMemberAsLegendUnit: [{
type: Input
}], highMemberAsLegendUnit: [{
type: Input
}], closeMemberAsLegendUnit: [{
type: Input
}], openMemberAsLegendUnit: [{
type: Input
}] } });