UNPKG

igniteui-react-charts

Version:

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

111 lines (110 loc) 3.25 kB
import { IgrSeries } from "./igr-series"; import { IgrSeriesMatcher } from "./igr-series-matcher"; import { ChartSelection as ChartSelection_internal } from "./ChartSelection"; /** * Represents a selected item within the chart. This should be treated as immutable while in the selected items collection. Changes while part of the collection will not be respected. */ export class IgrChartSelection { createImplementation() { return new ChartSelection_internal(); } get nativeElement() { return this._implementation.nativeElement; } /** * @hidden */ get i() { return this._implementation; } onImplementationCreated() { } constructor() { this.mounted = false; this._implementation = this.createImplementation(); this._implementation.externalObject = this; this.onImplementationCreated(); if (this._initializeAdapters) { this._initializeAdapters(); } } _provideImplementation(i) { this._implementation = i; this._implementation.externalObject = this; this.onImplementationCreated(); if (this._initializeAdapters) { this._initializeAdapters(); } } get item() { return this.i.item; } set item(v) { this.i.item = v; } get series() { const r = this.i.series; 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 series(v) { v == null ? this.i.series = null : this.i.series = v.i; } /** * If set, allows for selecting a series based on a matcher. This should resolve to a single static series at the time that the chart selection is added to selected items. * It will not be re-evaluated while the ChartSelection is in the selected items. */ get matcher() { const r = this.i.c; 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 matcher(v) { v == null ? this.i.c = null : this.i.c = v.i; } findByName(name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } if (this.series && this.series.name && this.series.name == name) { return this.series; } if (this.matcher && this.matcher.name && this.matcher.name == name) { return this.matcher; } return null; } equals(other) { let iv = this.i.equals(other); return (iv); } getHashCode() { let iv = this.i.getHashCode(); return (iv); } }