igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
271 lines (270 loc) • 8.08 kB
JavaScript
import { AxisAnnotation as AxisAnnotation_internal } from "./AxisAnnotation";
import { brushToString, stringToBrush, ensureBool, arrayFindByName } from "igniteui-angular-core";
/**
* Represents an axis annotation
*/
export class IgxAxisAnnotation {
constructor() {
this._zoneRunner = null;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
createImplementation() {
return new AxisAnnotation_internal();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
onImplementationCreated() {
}
_provideImplementation(i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
}
/**
* Gets or sets the value at which this annotation is displayed on the axis.
*/
get value() {
return this.i.value;
}
set value(v) {
this.i.value = 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 corner radius to use for the axis annotation borders.
*/
get backgroundCornerRadius() {
return this.i.backgroundCornerRadius;
}
set backgroundCornerRadius(v) {
this.i.backgroundCornerRadius = +v;
}
/**
* Gets or sets the label format string to use for the label.
*/
get labelFormat() {
return this.i.labelFormat;
}
set labelFormat(v) {
this.i.labelFormat = v;
}
/**
* Gets or sets the format specifiers to use with the LabelFormat string.
*/
get labelFormatSpecifiers() {
return this.i.labelFormatSpecifiers;
}
set labelFormatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.labelFormatSpecifiers = 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 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 whether the annotation is pill shaped. This will automatically adjust the background corner radius to make
* it appear pill shaped.
*/
get isPillShaped() {
return this.i.isPillShaped;
}
set isPillShaped(v) {
this.i.isPillShaped = ensureBool(v);
}
/**
* Gets or sets whether the badge is enabled in the annotation.
*/
get isBadgeEnabled() {
return this.i.isBadgeEnabled;
}
set isBadgeEnabled(v) {
this.i.isBadgeEnabled = ensureBool(v);
}
/**
* Gets or sets the background color to use for the badge inside the axis annotation box.
*/
get badgeBackground() {
return brushToString(this.i.badgeBackground);
}
set badgeBackground(v) {
this.i.badgeBackground = stringToBrush(v);
}
/**
* Gets or sets the outline color to use for the badge inside the axis annotation box.
*/
get badgeOutline() {
return brushToString(this.i.badgeOutline);
}
set badgeOutline(v) {
this.i.badgeOutline = stringToBrush(v);
}
/**
* Gets or sets the outline thickness for the badge inside the axis annotation box.
*/
get badgeOutlineThickness() {
return this.i.badgeOutlineThickness;
}
set badgeOutlineThickness(v) {
this.i.badgeOutlineThickness = +v;
}
/**
* Gets or sets the corner radius for the badge inside the axis annotation box.
*/
get badgeCornerRadius() {
return this.i.badgeCornerRadius;
}
set badgeCornerRadius(v) {
this.i.badgeCornerRadius = +v;
}
/**
* Gets or sets the spacing between the badge and text inside the axis annotation box.
*/
get badgeMargin() {
return this.i.badgeMargin;
}
set badgeMargin(v) {
this.i.badgeMargin = +v;
}
/**
* Gets or sets the size of the badge inside the axis annotation box.
*/
get badgeSize() {
return this.i.badgeSize;
}
set badgeSize(v) {
this.i.badgeSize = +v;
}
/**
* Gets or sets the image path to use for the badge.
*/
get badgeImagePath() {
return this.i.badgeImagePath;
}
set badgeImagePath(v) {
this.i.badgeImagePath = v;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.labelFormatSpecifiers != null && arrayFindByName(this.labelFormatSpecifiers, name)) {
return arrayFindByName(this.labelFormatSpecifiers, name);
}
return null;
}
resetCachedExtent() {
this.i.resetCachedExtent();
}
resolveLabelValue() {
let iv = this.i.resolveLabelValue();
return (iv);
}
_runInZone(act) {
if (this._zoneRunner != null) {
this._zoneRunner(act);
}
else {
act();
}
}
}