igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
89 lines (88 loc) • 2.73 kB
JavaScript
import { IgxAxisComponent } from "./igx-axis-component";
import { IgxAxisMatcher } from "./igx-axis-matcher";
import { IgxUserBaseAnnotation } from "./igx-user-base-annotation";
import { UserAxisAnnotation as UserAxisAnnotation_internal } from "./UserAxisAnnotation";
/**
* Represents an user annotation for rendering annotation of axis label
*/
export class IgxUserAxisAnnotation extends IgxUserBaseAnnotation {
constructor() {
super();
}
createImplementation() {
return new UserAxisAnnotation_internal();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets or sets the target axis that will display the annotation.
*/
get targetAxis() {
const r = this.i.targetAxis;
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 targetAxis(v) {
v == null ? this.i.targetAxis = null : this.i.targetAxis = v.i;
}
/**
* Gets or sets a matcher for matching an axis that will display the annotation.
*/
get targetAxisMatcher() {
const r = this.i.targetAxisMatcher;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgxAxisMatcher();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set targetAxisMatcher(v) {
v == null ? this.i.targetAxisMatcher = null : this.i.targetAxisMatcher = v.i;
}
/**
* Gets or sets the value that determines location of annotation on axis.
*/
get value() {
return this.i.value;
}
set value(v) {
this.i.value = +v;
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.targetAxis && this.targetAxis.name && this.targetAxis.name == name) {
return this.targetAxis;
}
if (this.targetAxisMatcher && this.targetAxisMatcher.name && this.targetAxisMatcher.name == name) {
return this.targetAxisMatcher;
}
return null;
}
}