igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
145 lines (144 loc) • 4.39 kB
JavaScript
import { IgrSeries } from "./igr-series";
import { TrendLineType_$type } from "igniteui-react-core";
import { IgrAnnotationLayer } from "./igr-annotation-layer";
import { TrendLineLayer } from "./TrendLineLayer";
import { ensureEnum } from "igniteui-react-core";
/**
* Represents the class of the value overlay. The value overlay is a line or circle representing a value on an axis.
*/
export class IgrTrendLineLayer extends IgrAnnotationLayer {
createImplementation() {
return new TrendLineLayer();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor(props) {
super(props);
this._targetSeriesName = null;
}
get isAnnotationLayer() {
return this.i.eu;
}
get isLineOnly() {
return this.i.fl;
}
/**
* Gets or sets the series to target this annotation to.
*/
get targetSeries() {
const r = this.i.aah;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgrSeries._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set targetSeries(v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.aah = null : this.i.aah = v.i;
}
/**
* Gets or sets the name to use to resolve targetSeries from markup.
*/
get targetSeriesName() {
return this._targetSeriesName;
}
set targetSeriesName(v) {
this._targetSeriesName = v;
}
/**
* Gets the actual series being targeted by this annotation.
*/
get actualTargetSeries() {
const r = this.i.aag;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgrSeries._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set actualTargetSeries(v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.aag = null : this.i.aag = v.i;
}
/**
* Gets or sets the trend type for the current series object.
*/
get trendLineType() {
return this.i.aaj;
}
set trendLineType(v) {
this.i.aaj = ensureEnum(TrendLineType_$type, v);
}
/**
* Gets or sets the trend line period for the target series.
* The typical, and initial, value for trend line period is 7.
*/
get trendLinePeriod() {
return this.i.aak;
}
set trendLinePeriod(v) {
this.i.aak = +v;
}
get isUsableInLegend() {
return this.i.isUsableInLegend;
}
bindSeries(series) {
super.bindSeries(series);
for (let i = 0; i < series.length; i++) {
if (this.targetSeriesName && this.targetSeriesName.length > 0 &&
series[i].name == this.targetSeriesName) {
this.targetSeries = series[i];
}
}
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.targetSeries && this.targetSeries.name && this.targetSeries.name == name) {
return this.targetSeries;
}
if (this.actualTargetSeries && this.actualTargetSeries.name && this.actualTargetSeries.name == name) {
return this.actualTargetSeries;
}
return null;
}
_styling(container, component, parent) {
super._styling(container, component, parent);
this._inStyling = true;
if (this.targetSeries && this.targetSeries._styling) {
this.targetSeries._styling(container, component, this);
}
if (this.actualTargetSeries && this.actualTargetSeries._styling) {
this.actualTargetSeries._styling(container, component, this);
}
this._inStyling = false;
}
onApplyTemplate() {
this.i.ac();
}
getManagerIdentifier() {
let iv = this.i.aam();
return (iv);
}
}