igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
133 lines (132 loc) • 4.59 kB
JavaScript
import { __extends } from "tslib";
import { IgcAxisComponent } from "./igc-axis-component";
import { IgcAxisMatcher } from "./igc-axis-matcher";
import { IgcUserBaseAnnotation } from "./igc-user-base-annotation";
import { UserAxisAnnotation as UserAxisAnnotation_internal } from "./UserAxisAnnotation";
/**
* Represents an user annotation for rendering annotation of axis label
*/
var IgcUserAxisAnnotation = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcUserAxisAnnotation, _super);
function IgcUserAxisAnnotation() {
var _this = _super.call(this) || this;
_this._targetAxisName = null;
return _this;
}
IgcUserAxisAnnotation.prototype.createImplementation = function () {
return new UserAxisAnnotation_internal();
};
Object.defineProperty(IgcUserAxisAnnotation.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcUserAxisAnnotation.prototype, "targetAxis", {
/**
* Gets or sets the target axis that will display the annotation.
*/
get: function () {
var r = this.i.targetAxis;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = IgcAxisComponent._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
},
set: function (v) {
v == null ? this.i.targetAxis = null : this.i.targetAxis = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcUserAxisAnnotation.prototype, "targetAxisName", {
/**
* Gets or sets the name to use to resolve targetAxis from markup.
*/
get: function () {
return this._targetAxisName;
},
set: function (v) {
this._targetAxisName = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcUserAxisAnnotation.prototype, "targetAxisMatcher", {
/**
* Gets or sets a matcher for matching an axis that will display the annotation.
*/
get: function () {
var r = this.i.targetAxisMatcher;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = new IgcAxisMatcher();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
},
set: function (v) {
v == null ? this.i.targetAxisMatcher = null : this.i.targetAxisMatcher = v.i;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcUserAxisAnnotation.prototype, "value", {
/**
* Gets or sets the value that determines location of annotation on axis.
*/
get: function () {
return this.i.value;
},
set: function (v) {
this.i.value = +v;
},
enumerable: false,
configurable: true
});
IgcUserAxisAnnotation.prototype.bindAxes = function (axes) {
_super.prototype.bindAxes.call(this, axes);
for (var i = 0; i < axes.length; i++) {
if (this.targetAxisName && this.targetAxisName.length > 0 &&
axes[i].name == this.targetAxisName) {
this.targetAxis = axes[i];
}
}
};
IgcUserAxisAnnotation.prototype.findByName = function (name) {
var baseResult = _super.prototype.findByName.call(this, 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;
};
return IgcUserAxisAnnotation;
}(IgcUserBaseAnnotation));
export { IgcUserAxisAnnotation };