igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
307 lines (306 loc) • 8.71 kB
JavaScript
import { IgxSeriesComponent } from "./igx-series-component";
import { CalloutAnnotation as CalloutAnnotation_internal } from "./CalloutAnnotation";
import { brushToString, stringToBrush, ensureBool } from "igniteui-angular-core";
/**
* Represents a callout annotation
*/
export class IgxCalloutAnnotation {
constructor() {
this._zoneRunner = null;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
createImplementation() {
return new CalloutAnnotation_internal();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
onImplementationCreated() {
}
_provideImplementation(i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
}
/**
* Gets or sets the XValue at which this annotation is displayed on the axis.
*/
get xValue() {
return this.i.xValue;
}
set xValue(v) {
this.i.xValue = v;
}
/**
* Gets or sets the YValue at which this annotation is displayed on the axis.
*/
get yValue() {
return this.i.yValue;
}
set yValue(v) {
this.i.yValue = v;
}
/**
* Gets or sets the text that should be displayed for the annotation. Leave null to display the value automatically.
*/
get text() {
return this.i.text;
}
set text(v) {
this.i.text = v;
}
/**
* Gets or sets the Key that should be annotated.
*/
get key() {
return this.i.key;
}
set key(v) {
this.i.key = v;
}
/**
* Gets or sets the Content that should be annotated.
*/
get content() {
return this.i.content;
}
set content(v) {
this.i.content = v;
}
/**
* Gets or sets the series to which the callout pertains to. Leave unset for an automatic value.
*/
get series() {
const r = this.i.series;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgxSeriesComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set series(v) {
v == null ? this.i.series = null : this.i.series = v.i;
}
/**
* Gets or sets the ItemColor to which the callout pertains to. Leave unset for an automatic value.
*/
get itemColor() {
return brushToString(this.i.itemColor);
}
set itemColor(v) {
this.i.itemColor = stringToBrush(v);
}
/**
* Sets or gets a function which takes an object that produces a formatted label for the value of this annotation.
*/
get formatLabel() {
return this.i.formatLabel;
}
set formatLabel(v) {
this.i.formatLabel = v;
}
/**
* Gets or sets the color to use for the text in the annotation.
*/
get textColor() {
return brushToString(this.i.textColor);
}
set textColor(v) {
this.i.textColor = stringToBrush(v);
}
/**
* Gets or sets the background to use for tha axis annotation box.
*/
get background() {
return brushToString(this.i.background);
}
set background(v) {
this.i.background = stringToBrush(v);
}
/**
* Gets or sets the Outline to use for tha axis annotation box.
*/
get outline() {
return brushToString(this.i.outline);
}
set outline(v) {
this.i.outline = stringToBrush(v);
}
/**
* Gets or sets the LeaderBrush to use for tha axis annotation box.
*/
get leaderBrush() {
return brushToString(this.i.leaderBrush);
}
set leaderBrush(v) {
this.i.leaderBrush = stringToBrush(v);
}
/**
* Gets or sets the border stroke thickness to use for tha axis annotation box.
*/
get strokeThickness() {
return this.i.strokeThickness;
}
set strokeThickness(v) {
this.i.strokeThickness = +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 backgroundPaddingLeft() {
return this.i.backgroundPaddingLeft;
}
set backgroundPaddingLeft(v) {
this.i.backgroundPaddingLeft = +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 backgroundPaddingTop() {
return this.i.backgroundPaddingTop;
}
set backgroundPaddingTop(v) {
this.i.backgroundPaddingTop = +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 backgroundPaddingRight() {
return this.i.backgroundPaddingRight;
}
set backgroundPaddingRight(v) {
this.i.backgroundPaddingRight = +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 backgroundPaddingBottom() {
return this.i.backgroundPaddingBottom;
}
set backgroundPaddingBottom(v) {
this.i.backgroundPaddingBottom = +v;
}
/**
* Gets or sets the corner radius to use for the callout borders.
*/
get backgroundCornerRadius() {
return this.i.backgroundCornerRadius;
}
set backgroundCornerRadius(v) {
this.i.backgroundCornerRadius = +v;
}
/**
* Gets or sets the badge is visible in callout annotation.
*/
get badgeVisible() {
return this.i.badgeVisible;
}
set badgeVisible(v) {
this.i.badgeVisible = ensureBool(v);
}
/**
* Gets or sets the width of badge in the callout annotation.
*/
get badgeWidth() {
return this.i.badgeWidth;
}
set badgeWidth(v) {
this.i.badgeWidth = +v;
}
/**
* Gets or sets the height of badge in the callout annotation.
*/
get badgeHeight() {
return this.i.badgeHeight;
}
set badgeHeight(v) {
this.i.badgeHeight = +v;
}
/**
* Gets or sets the thickness of badge in the callout annotation.
*/
get badgeThickness() {
return this.i.badgeThickness;
}
set badgeThickness(v) {
this.i.badgeThickness = +v;
}
/**
* Gets or sets the outline of badge in the callout annotation.
*/
get badgeOutline() {
return brushToString(this.i.badgeOutline);
}
set badgeOutline(v) {
this.i.badgeOutline = stringToBrush(v);
}
/**
* Gets or sets the background of badge in the callout annotation.
*/
get badgeBackground() {
return brushToString(this.i.badgeBackground);
}
set badgeBackground(v) {
this.i.badgeBackground = stringToBrush(v);
}
/**
* Gets or sets the image url displayed as a badge in the callout annotation.
*/
get badgeImage() {
return this.i.badgeImage;
}
set badgeImage(v) {
this.i.badgeImage = v;
}
/**
* Gets or sets the space between badge and text in the callout annotation.
*/
get badgeGap() {
return this.i.badgeGap;
}
set badgeGap(v) {
this.i.badgeGap = +v;
}
/**
* Gets or sets the corner radius of badge in the callout annotation.
*/
get badgeCorner() {
return this.i.badgeCorner;
}
set badgeCorner(v) {
this.i.badgeCorner = +v;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.series && this.series.name && this.series.name == name) {
return this.series;
}
return null;
}
_runInZone(act) {
if (this._zoneRunner != null) {
this._zoneRunner(act);
}
else {
act();
}
}
}