igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
572 lines (567 loc) • 20.7 kB
JavaScript
import { EventEmitter, Output, Component, forwardRef, Input, ChangeDetectionStrategy } from '@angular/core';
import { delegateCombine } from "igniteui-angular-core";
import { IgxAxisComponent } from "./igx-axis-component";
import { OverlayTextLocation, OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode, AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { IgxOverlayTextUpdatingEventArgs } from "./igx-overlay-text-updating-event-args";
import { IgxSeriesComponent } from "./igx-series-component";
import { ValueOverlay } from "./ValueOverlay";
import { ensureBool, brushToString, stringToBrush, ensureEnum, toPoint, fromPoint } from "igniteui-angular-core";
import { FontInfo } from "igniteui-angular-core";
import * as i0 from "@angular/core";
/**
* Represents the class of the value overlay. The value overlay is a line or circle representing a value on an axis.
*/
export class IgxValueOverlayComponent extends IgxSeriesComponent {
createImplementation() {
return new ValueOverlay();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
this._stylingOverlayText = null;
}
/**
* Gets or sets the axis used by the value overlay.
*/
get axis() {
const r = this.i.xo;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgxAxisComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
Object.defineProperty(r, 'externalObject', { value: e, enumerable: false, configurable: true, writable: true });
}
return r.externalObject;
}
set axis(v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.xo = null : this.i.xo = v.i;
}
/**
* Gets or sets the value of the overlay.
*/
get value() {
return this.i.yr;
}
set value(v) {
this.i.yr = +v;
}
/**
* Gets or sets the value of the overlay as a date. If this is set to something other than the minimum date, then it will be preferred over the Value property.
*/
get dateValue() {
return this.i.x4;
}
set dateValue(v) {
this.i.x4 = v;
}
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get isAxisAnnotationEnabled() {
return this.i.xw;
}
set isAxisAnnotationEnabled(v) {
this.i.xw = ensureBool(v);
}
/**
* Sets or gets a function which takes an object that produces a formatted label for the axis annotation.
*/
get axisAnnotationFormatLabel() {
return this.i.xq;
}
set axisAnnotationFormatLabel(v) {
this.i.xq = v;
}
/**
* Gets or sets the color to use for the axis annotation text. Leave unset for an automatic value.
*/
get axisAnnotationTextColor() {
return brushToString(this.i.aa4);
}
set axisAnnotationTextColor(v) {
this.i.aa4 = stringToBrush(v);
}
/**
* Gets or sets the color to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackground() {
return brushToString(this.i.aa2);
}
set axisAnnotationBackground(v) {
this.i.aa2 = stringToBrush(v);
}
/**
* Gets or sets the corner radius to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackgroundCornerRadius() {
return this.i.x5;
}
set axisAnnotationBackgroundCornerRadius(v) {
this.i.x5 = +v;
}
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get axisAnnotationInterpolatedValuePrecision() {
return this.i.ys;
}
set axisAnnotationInterpolatedValuePrecision(v) {
this.i.ys = +v;
}
/**
* Gets or sets the color to use for the axis annotation outline. Leave unset for an automatic value.
*/
get axisAnnotationOutline() {
return brushToString(this.i.aa3);
}
set axisAnnotationOutline(v) {
this.i.aa3 = stringToBrush(v);
}
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get axisAnnotationPaddingLeft() {
return this.i.x7;
}
set axisAnnotationPaddingLeft(v) {
this.i.x7 = +v;
}
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get axisAnnotationPaddingTop() {
return this.i.x9;
}
set axisAnnotationPaddingTop(v) {
this.i.x9 = +v;
}
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get axisAnnotationPaddingRight() {
return this.i.x8;
}
set axisAnnotationPaddingRight(v) {
this.i.x8 = +v;
}
/**
* Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins.
*/
get axisAnnotationPaddingBottom() {
return this.i.x6;
}
set axisAnnotationPaddingBottom(v) {
this.i.x6 = +v;
}
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationStrokeThickness() {
return this.i.ya;
}
set axisAnnotationStrokeThickness(v) {
this.i.ya = +v;
}
/**
* Gets whether the series is a value overlay.
*/
get isValueOverlay() {
return this.i.isValueOverlay;
}
get labelResolved() {
return this.i.y8;
}
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get overlayTextLocation() {
return this.i.xr;
}
set overlayTextLocation(v) {
this.i.xr = ensureEnum(OverlayTextLocation_$type, v);
}
/**
* Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalMargin() {
return this.i.yj;
}
set overlayTextHorizontalMargin(v) {
this.i.yj = +v;
}
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalMargin() {
return this.i.yl;
}
set overlayTextVerticalMargin(v) {
this.i.yl = +v;
}
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalPadding() {
return this.i.yk;
}
set overlayTextHorizontalPadding(v) {
this.i.yk = +v;
}
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalPadding() {
return this.i.ym;
}
set overlayTextVerticalPadding(v) {
this.i.ym = +v;
}
/**
* Gets or sets the angle rotation (in degrees) of the overlay text in relation to shape of data annotation.
*/
get overlayTextAngle() {
return this.i.yd;
}
set overlayTextAngle(v) {
this.i.yd = +v;
}
/**
* Gets or sets the color the overlay text.
*/
get overlayTextColor() {
return brushToString(this.i.aa7);
}
set overlayTextColor(v) {
this.i.aa7 = stringToBrush(v);
}
/**
* Gets or sets the background the overlay text.
*/
get overlayTextBackground() {
return brushToString(this.i.aa5);
}
set overlayTextBackground(v) {
this.i.aa5 = stringToBrush(v);
}
/**
* Gets or sets the border stroke of the overlay text.
*/
get overlayTextBorderColor() {
return brushToString(this.i.aa6);
}
set overlayTextBorderColor(v) {
this.i.aa6 = stringToBrush(v);
}
/**
* Gets or sets the border corner of the overlay text.
*/
get overlayTextBorderRadius() {
return this.i.yf;
}
set overlayTextBorderRadius(v) {
this.i.yf = +v;
}
/**
* Gets or sets the border thickness of the overlay text.
*/
get overlayTextBorderThickness() {
return this.i.yh;
}
set overlayTextBorderThickness(v) {
this.i.yh = +v;
}
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get overlayTextVisible() {
return this.i.x0;
}
set overlayTextVisible(v) {
this.i.x0 = ensureBool(v);
}
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get overlayText() {
return this.i.y9;
}
set overlayText(v) {
this.i.y9 = v;
}
/**
* Gets or sets the shift of the overlay text color based on OverlayTextColorMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextColorShift() {
return this.i.yi;
}
set overlayTextColorShift(v) {
this.i.yi = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextColorMode() {
return this.i.xn;
}
set overlayTextColorMode(v) {
this.i.xn = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get overlayTextColorMatchLayer() {
return this.i.xz;
}
set overlayTextColorMatchLayer(v) {
this.i.xz = ensureBool(v);
}
/**
* Gets or sets the shift of the overlay background based on OverlayTextBackgroundMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextBackgroundShift() {
return this.i.ye;
}
set overlayTextBackgroundShift(v) {
this.i.ye = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextBackgroundMode() {
return this.i.xl;
}
set overlayTextBackgroundMode(v) {
this.i.xl = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get overlayTextBackgroundMatchLayer() {
return this.i.xx;
}
set overlayTextBackgroundMatchLayer(v) {
this.i.xx = ensureBool(v);
}
/**
* Gets or sets the shift of the overlay border based on OverlayTextBorderMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextBorderShift() {
return this.i.yg;
}
set overlayTextBorderShift(v) {
this.i.yg = +v;
}
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get overlayTextBorderMode() {
return this.i.xm;
}
set overlayTextBorderMode(v) {
this.i.xm = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get overlayTextBorderMatchLayer() {
return this.i.xy;
}
set overlayTextBorderMatchLayer(v) {
this.i.xy = ensureBool(v);
}
/**
* Gets or Sets the style to use for the display text.
*/
get overlayTextStyle() {
if (this.i.xv == null) {
return null;
}
return this.i.xv.fontString;
}
set overlayTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.xv = fi;
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.axis && this.axis.name && this.axis.name == name) {
return this.axis;
}
return null;
}
_styling(container, component, parent) {
super._styling(container, component, parent);
this._inStyling = true;
if (this.axis && this.axis._styling) {
this.axis._styling(container, component, this);
}
this._inStyling = false;
}
getSeriesValue(world, useInterpolation, skipUnknowns) {
let iv = this.i.jf(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
}
getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
let iv = this.i.wy(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
}
/**
* Gets the item index associated with the specified world position
* @param world
*/
getItemIndex(world) {
let iv = this.i.ke(toPoint(world));
return (iv);
}
/**
* Gets the item that is the best match for the specified world coordinates.
* @param world * The world coordinates to use.
*/
getItem(world) {
let iv = this.i.ky(toPoint(world));
return (iv);
}
/**
* Requests that the provided item should be brought into view if possible.
* @param item * The item to attempt to bring into view.
*/
scrollIntoView(item) {
let iv = this.i.gl(item);
return (iv);
}
/**
* Gets the label for a data item.
* @param value * The unscaled value to get a label for.
*/
getLabel(value) {
let iv = this.i.y6(value);
return (iv);
}
/**
* Event raised when updating style of overlay text
*/
get stylingOverlayText() {
if (this._stylingOverlayText == null) {
this._stylingOverlayText = new EventEmitter();
this.i.stylingOverlayText = delegateCombine(this.i.stylingOverlayText, (o, e) => {
this._runInZone(() => {
let outerArgs = new IgxOverlayTextUpdatingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStylingOverlayText) {
this.beforeStylingOverlayText(this, outerArgs);
}
this._stylingOverlayText.emit({
sender: this,
args: outerArgs
});
});
});
}
return this._stylingOverlayText;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0-rc.1", ngImport: i0, type: IgxValueOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0-rc.1", type: IgxValueOverlayComponent, isStandalone: true, selector: "igx-value-overlay", inputs: { axis: "axis", value: "value", dateValue: "dateValue", isAxisAnnotationEnabled: "isAxisAnnotationEnabled", axisAnnotationFormatLabel: "axisAnnotationFormatLabel", axisAnnotationTextColor: "axisAnnotationTextColor", axisAnnotationBackground: "axisAnnotationBackground", axisAnnotationBackgroundCornerRadius: "axisAnnotationBackgroundCornerRadius", axisAnnotationInterpolatedValuePrecision: "axisAnnotationInterpolatedValuePrecision", axisAnnotationOutline: "axisAnnotationOutline", axisAnnotationPaddingLeft: "axisAnnotationPaddingLeft", axisAnnotationPaddingTop: "axisAnnotationPaddingTop", axisAnnotationPaddingRight: "axisAnnotationPaddingRight", axisAnnotationPaddingBottom: "axisAnnotationPaddingBottom", axisAnnotationStrokeThickness: "axisAnnotationStrokeThickness", overlayTextLocation: "overlayTextLocation", overlayTextHorizontalMargin: "overlayTextHorizontalMargin", overlayTextVerticalMargin: "overlayTextVerticalMargin", overlayTextHorizontalPadding: "overlayTextHorizontalPadding", overlayTextVerticalPadding: "overlayTextVerticalPadding", overlayTextAngle: "overlayTextAngle", overlayTextColor: "overlayTextColor", overlayTextBackground: "overlayTextBackground", overlayTextBorderColor: "overlayTextBorderColor", overlayTextBorderRadius: "overlayTextBorderRadius", overlayTextBorderThickness: "overlayTextBorderThickness", overlayTextVisible: "overlayTextVisible", overlayText: "overlayText", overlayTextColorShift: "overlayTextColorShift", overlayTextColorMode: "overlayTextColorMode", overlayTextColorMatchLayer: "overlayTextColorMatchLayer", overlayTextBackgroundShift: "overlayTextBackgroundShift", overlayTextBackgroundMode: "overlayTextBackgroundMode", overlayTextBackgroundMatchLayer: "overlayTextBackgroundMatchLayer", overlayTextBorderShift: "overlayTextBorderShift", overlayTextBorderMode: "overlayTextBorderMode", overlayTextBorderMatchLayer: "overlayTextBorderMatchLayer", overlayTextStyle: "overlayTextStyle" }, outputs: { stylingOverlayText: "stylingOverlayText" }, providers: [{ provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxValueOverlayComponent) }], usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0-rc.1", ngImport: i0, type: IgxValueOverlayComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-value-overlay',
template: ``,
providers: [{ provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxValueOverlayComponent) }],
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: () => [], propDecorators: { axis: [{
type: Input
}], value: [{
type: Input
}], dateValue: [{
type: Input
}], isAxisAnnotationEnabled: [{
type: Input
}], axisAnnotationFormatLabel: [{
type: Input
}], axisAnnotationTextColor: [{
type: Input
}], axisAnnotationBackground: [{
type: Input
}], axisAnnotationBackgroundCornerRadius: [{
type: Input
}], axisAnnotationInterpolatedValuePrecision: [{
type: Input
}], axisAnnotationOutline: [{
type: Input
}], axisAnnotationPaddingLeft: [{
type: Input
}], axisAnnotationPaddingTop: [{
type: Input
}], axisAnnotationPaddingRight: [{
type: Input
}], axisAnnotationPaddingBottom: [{
type: Input
}], axisAnnotationStrokeThickness: [{
type: Input
}], overlayTextLocation: [{
type: Input
}], overlayTextHorizontalMargin: [{
type: Input
}], overlayTextVerticalMargin: [{
type: Input
}], overlayTextHorizontalPadding: [{
type: Input
}], overlayTextVerticalPadding: [{
type: Input
}], overlayTextAngle: [{
type: Input
}], overlayTextColor: [{
type: Input
}], overlayTextBackground: [{
type: Input
}], overlayTextBorderColor: [{
type: Input
}], overlayTextBorderRadius: [{
type: Input
}], overlayTextBorderThickness: [{
type: Input
}], overlayTextVisible: [{
type: Input
}], overlayText: [{
type: Input
}], overlayTextColorShift: [{
type: Input
}], overlayTextColorMode: [{
type: Input
}], overlayTextColorMatchLayer: [{
type: Input
}], overlayTextBackgroundShift: [{
type: Input
}], overlayTextBackgroundMode: [{
type: Input
}], overlayTextBackgroundMatchLayer: [{
type: Input
}], overlayTextBorderShift: [{
type: Input
}], overlayTextBorderMode: [{
type: Input
}], overlayTextBorderMatchLayer: [{
type: Input
}], overlayTextStyle: [{
type: Input
}], stylingOverlayText: [{
type: Output
}] } });