igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
575 lines (570 loc) • 22.6 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_$type } from "./OverlayTextLocation";
import { 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 let IgxValueOverlayComponent = /*@__PURE__*/ (() => {
class IgxValueOverlayComponent extends IgxSeriesComponent {
constructor() {
super();
this._stylingOverlayText = null;
}
createImplementation() {
return new ValueOverlay();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets or sets the axis used by the value overlay.
*/
get axis() {
const r = this.i.xl;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgxAxisComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set axis(v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.xl = null : this.i.xl = v.i;
}
/**
* Gets or sets the value of the overlay.
*/
get value() {
return this.i.yo;
}
set value(v) {
this.i.yo = +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.x1;
}
set dateValue(v) {
this.i.x1 = v;
}
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get isAxisAnnotationEnabled() {
return this.i.xt;
}
set isAxisAnnotationEnabled(v) {
this.i.xt = 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.xn;
}
set axisAnnotationFormatLabel(v) {
this.i.xn = 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.aa1);
}
set axisAnnotationTextColor(v) {
this.i.aa1 = 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.aaz);
}
set axisAnnotationBackground(v) {
this.i.aaz = 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.x2;
}
set axisAnnotationBackgroundCornerRadius(v) {
this.i.x2 = +v;
}
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get axisAnnotationInterpolatedValuePrecision() {
return this.i.yp;
}
set axisAnnotationInterpolatedValuePrecision(v) {
this.i.yp = +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.aa0);
}
set axisAnnotationOutline(v) {
this.i.aa0 = 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.x4;
}
set axisAnnotationPaddingLeft(v) {
this.i.x4 = +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.x6;
}
set axisAnnotationPaddingTop(v) {
this.i.x6 = +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.x5;
}
set axisAnnotationPaddingRight(v) {
this.i.x5 = +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.x3;
}
set axisAnnotationPaddingBottom(v) {
this.i.x3 = +v;
}
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationStrokeThickness() {
return this.i.x7;
}
set axisAnnotationStrokeThickness(v) {
this.i.x7 = +v;
}
/**
* Gets whether the series is a value overlay.
*/
get isValueOverlay() {
return this.i.isValueOverlay;
}
get labelResolved() {
return this.i.y5;
}
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get overlayTextLocation() {
return this.i.xo;
}
set overlayTextLocation(v) {
this.i.xo = 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.yg;
}
set overlayTextHorizontalMargin(v) {
this.i.yg = +v;
}
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalMargin() {
return this.i.yi;
}
set overlayTextVerticalMargin(v) {
this.i.yi = +v;
}
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalPadding() {
return this.i.yh;
}
set overlayTextHorizontalPadding(v) {
this.i.yh = +v;
}
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalPadding() {
return this.i.yj;
}
set overlayTextVerticalPadding(v) {
this.i.yj = +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.ya;
}
set overlayTextAngle(v) {
this.i.ya = +v;
}
/**
* Gets or sets the color the overlay text.
*/
get overlayTextColor() {
return brushToString(this.i.aa4);
}
set overlayTextColor(v) {
this.i.aa4 = stringToBrush(v);
}
/**
* Gets or sets the background the overlay text.
*/
get overlayTextBackground() {
return brushToString(this.i.aa2);
}
set overlayTextBackground(v) {
this.i.aa2 = stringToBrush(v);
}
/**
* Gets or sets the border stroke of the overlay text.
*/
get overlayTextBorderColor() {
return brushToString(this.i.aa3);
}
set overlayTextBorderColor(v) {
this.i.aa3 = stringToBrush(v);
}
/**
* Gets or sets the border corner of the overlay text.
*/
get overlayTextBorderRadius() {
return this.i.yc;
}
set overlayTextBorderRadius(v) {
this.i.yc = +v;
}
/**
* Gets or sets the border thickness of the overlay text.
*/
get overlayTextBorderThickness() {
return this.i.ye;
}
set overlayTextBorderThickness(v) {
this.i.ye = +v;
}
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get overlayTextVisible() {
return this.i.xx;
}
set overlayTextVisible(v) {
this.i.xx = ensureBool(v);
}
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get overlayText() {
return this.i.y6;
}
set overlayText(v) {
this.i.y6 = 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.yf;
}
set overlayTextColorShift(v) {
this.i.yf = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextColorMode() {
return this.i.xk;
}
set overlayTextColorMode(v) {
this.i.xk = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get overlayTextColorMatchLayer() {
return this.i.xw;
}
set overlayTextColorMatchLayer(v) {
this.i.xw = 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.yb;
}
set overlayTextBackgroundShift(v) {
this.i.yb = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextBackgroundMode() {
return this.i.xi;
}
set overlayTextBackgroundMode(v) {
this.i.xi = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get overlayTextBackgroundMatchLayer() {
return this.i.xu;
}
set overlayTextBackgroundMatchLayer(v) {
this.i.xu = 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.yd;
}
set overlayTextBorderShift(v) {
this.i.yd = +v;
}
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get overlayTextBorderMode() {
return this.i.xj;
}
set overlayTextBorderMode(v) {
this.i.xj = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get overlayTextBorderMatchLayer() {
return this.i.xv;
}
set overlayTextBorderMatchLayer(v) {
this.i.xv = ensureBool(v);
}
/**
* Gets or Sets the style to use for the display text.
*/
get overlayTextStyle() {
if (this.i.xs == null) {
return null;
}
return this.i.xs.fontString;
}
set overlayTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.xs = 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.jd(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
}
getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
let iv = this.i.wv(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.kc(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.kw(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.gj(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.y3(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;
}
}
IgxValueOverlayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxValueOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
IgxValueOverlayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxValueOverlayComponent, 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 });
return IgxValueOverlayComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxValueOverlayComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-value-overlay',
template: ``,
providers: [{ provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxValueOverlayComponent) }],
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: function () { return []; }, 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
}] } });