igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
279 lines (276 loc) • 11.2 kB
JavaScript
import { Component, forwardRef, Input, ChangeDetectionStrategy } from '@angular/core';
import { IgxHorizontalAnchoredCategorySeriesComponent } from "./igx-horizontal-anchored-category-series-component";
import { IgxAnchoredCategorySeriesComponent } from "./igx-anchored-category-series-component";
import { IgxCategorySeriesComponent } from "./igx-category-series-component";
import { IgxMarkerSeriesComponent } from "./igx-marker-series-component";
import { IgxSeriesComponent } from "./igx-series-component";
import { WaterfallSeries } from "./WaterfallSeries";
import { brushToString, stringToBrush, toPoint, fromRect } from "igniteui-angular-core";
import * as i0 from "@angular/core";
/**
* Represents a IgxDataChartComponent waterfall column series.
*
* `WaterfallSeries` belongs to a group of `CategorySeries` and it is rendered using a collection of vertical columns that show the difference between consecutive data points.
*
* ```html
* <igx-data-chart
* [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="label">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-waterfall-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* valueMemberPath="value">
* </igx-waterfall-series>
* </igx-data-chart>
* ```
*
* ```ts
* let series: IgxWaterfallSeriesComponent = new IgxWaterfallSeriesComponent();
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.valueMemberPath = "value";
* this.chart.series.add(series);
* ```
*/
export let IgxWaterfallSeriesComponent = /*@__PURE__*/ (() => {
class IgxWaterfallSeriesComponent extends IgxHorizontalAnchoredCategorySeriesComponent {
constructor() {
super();
}
createImplementation() {
return new WaterfallSeries();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets whether the current series shows a waterfall column shape.
*/
get isWaterfall() {
return this.i.f5;
}
/**
* Overridden by derived series classes to indicate when marker-less display is preferred or not.
*/
get isMarkerlessDisplayPreferred() {
return this.i.fk;
}
/**
* Gets whether the series is financial waterfall
*/
get isFinancialWaterfall() {
return this.i.fa;
}
/**
* Overridden by derived series classes to indicate when negative colors are supported or not.
*/
get isNegativeColorSupported() {
return this.i.fl;
}
/**
* Gets or sets the brush to use for negative portions of the series.
*
* Gets or sets the color used to draw negative declines in values for this `WaterfallSeries`.
*
* ```html
* <igx-data-chart
* [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="label">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-waterfall-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* negativeBrush="#ff0000"
* valueMemberPath="value">
* </igx-waterfall-series>
* </igx-data-chart>
* ```
*
* ```ts
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.valueMemberPath = "value";
* series.negativeBrush = "#ff0000";
* this.chart.series.add(series);
* ```
*/
get negativeBrush() {
return brushToString(this.i.ac6);
}
set negativeBrush(v) {
this.i.ac6 = stringToBrush(v);
}
/**
* Gets or sets the x-radius of the ellipse that is used to round the corners of the column.
*
* Gets or sets the amount to round corners in the direction of the X axis in this series.
*
* ```html
* <igx-data-chart
* [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="label">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-waterfall-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* radiusX="15"
* radiusY="15"
* valueMemberPath="value">
* </igx-waterfall-series>
* </igx-data-chart>
* ```
*
* ```ts
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.valueMemberPath = "value";
* series.radiusX = 15;
* series.radiusY = 15;
* this.chart.series.add(series);
* ```
*/
get radiusX() {
return this.i.acw;
}
set radiusX(v) {
this.i.acw = +v;
}
/**
* Gets or sets the y-radius of the ellipse that is used to round the corners of the column.
*
* Gets or sets the amount to round corners in the direction of the Y axis in this series.
*
* ```html
* <igx-data-chart
* [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="label">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-waterfall-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* radiusX="15"
* radiusY="15"
* valueMemberPath="value">
* </igx-waterfall-series>
* </igx-data-chart>
* ```
*
* ```ts
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.valueMemberPath = "value";
* series.radiusX = 15;
* series.radiusY = 15;
* this.chart.series.add(series);
* ```
*/
get radiusY() {
return this.i.acx;
}
set radiusY(v) {
this.i.acx = +v;
}
/**
* Brush to use for outlining negative elements in the waterfall series.
*
* Gets or sets the color used to draw borders of negative declines in values for this `WaterfallSeries`.
*
* ```html
* <igx-data-chart
* [dataSource]="data">
* <igx-category-x-axis #xAxis
* label="label">
* </igx-category-x-axis>
* <igx-numeric-y-axis #yAxis>
* </igx-numeric-y-axis>
* <igx-waterfall-series
* [xAxis]="xAxis"
* [yAxis]="yAxis"
* negativeOutline="#ff0000"
* valueMemberPath="value">
* </igx-waterfall-series>
* </igx-data-chart>
* ```
*
* ```ts
* series.xAxis = this.xAxis;
* series.yAxis = this.yAxis;
* series.valueMemberPath = "value";
* series.negativeOutline = "#ff0000";
* this.chart.series.add(series);
* ```
*/
get negativeOutline() {
return brushToString(this.i.ac7);
}
set negativeOutline(v) {
this.i.ac7 = stringToBrush(v);
}
setNegativeColors(negativeBrush, negativeOutline) {
this.i.r2(stringToBrush(negativeBrush), stringToBrush(negativeOutline));
}
/**
* 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
*
* Returns a bounding box `Rect` for a data value given a `Point`.
*
* ```ts
* let box : IgxRect = series.getSeriesValueBoundingBox({x: 4, y: 7});
* ```
*/
getSeriesValueBoundingBox(world) {
let iv = this.i.wm(toPoint(world));
return fromRect(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.
*
* Returns the width of items in the `WaterfallSeries`.
*
* ```ts
* let itemSpan: number = series.GetItemSpan();
* ```
*/
getItemSpan() {
let iv = this.i.iv();
return (iv);
}
}
IgxWaterfallSeriesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxWaterfallSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
IgxWaterfallSeriesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxWaterfallSeriesComponent, selector: "igx-waterfall-series", inputs: { negativeBrush: "negativeBrush", radiusX: "radiusX", radiusY: "radiusY", negativeOutline: "negativeOutline" }, providers: [{ provide: IgxHorizontalAnchoredCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxAnchoredCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxMarkerSeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }], usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxWaterfallSeriesComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxWaterfallSeriesComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-waterfall-series',
template: ``,
providers: [{ provide: IgxHorizontalAnchoredCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxAnchoredCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxCategorySeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxMarkerSeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxWaterfallSeriesComponent) }],
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: function () { return []; }, propDecorators: { negativeBrush: [{
type: Input
}], radiusX: [{
type: Input
}], radiusY: [{
type: Input
}], negativeOutline: [{
type: Input
}] } });