UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

117 lines (116 loc) 3.53 kB
import { IgrSeries } from "./igr-series"; import { IgrSeriesMatcher } from "./igr-series-matcher"; import { IgrUserBaseAnnotation } from "./igr-user-base-annotation"; import { UserPointAnnotation as UserPointAnnotation_internal } from "./UserPointAnnotation"; /** * Represents an user annotation for rendering data point annotation on a series */ export class IgrUserPointAnnotation extends IgrUserBaseAnnotation { createImplementation() { return new UserPointAnnotation_internal(); } /** * @hidden */ get i() { return this._implementation; } constructor() { super(); this._targetSeriesName = null; } /** * Gets or sets the target series that will display the annotation. */ get targetSeries() { const r = this.i.targetSeries; 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) { v == null ? this.i.targetSeries = null : this.i.targetSeries = 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 or sets a matcher for matching a series that will display the annotation. */ get targetSeriesMatcher() { const r = this.i.targetSeriesMatcher; if (r == null) { return null; } if (!r.externalObject) { let e = new IgrSeriesMatcher(); if (r.$type) { e._implementation = r; } else { if (e.i.setNativeElement) { e.i.setNativeElement(r); } } r.externalObject = e; } return r.externalObject; } set targetSeriesMatcher(v) { v == null ? this.i.targetSeriesMatcher = null : this.i.targetSeriesMatcher = v.i; } /** * Gets or sets the value that determines location of the annotation in the coordinates of x-axis. */ get xValue() { return this.i.xValue; } set xValue(v) { this.i.xValue = +v; } /** * Gets or sets the value that determines location of the annotation in the coordinates of y-axis. */ get yValue() { return this.i.yValue; } set yValue(v) { this.i.yValue = +v; } 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.targetSeriesMatcher && this.targetSeriesMatcher.name && this.targetSeriesMatcher.name == name) { return this.targetSeriesMatcher; } return null; } }