UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

100 lines (99 loc) 3.09 kB
import { IgxSeriesComponent } from "./igx-series-component"; import { IgxSeriesMatcher } from "./igx-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 IgxChartSelection { constructor() { this._implementation = this.createImplementation(); this._implementation.externalObject = this; this.onImplementationCreated(); if (this._initializeAdapters) { this._initializeAdapters(); } } createImplementation() { return new ChartSelection_internal(); } /** * @hidden */ get i() { return this._implementation; } onImplementationCreated() { } _provideImplementation(i) { this._implementation = i; this._implementation.externalObject = this; this.onImplementationCreated(); } 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 = IgxSeriesComponent._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 IgxSeriesMatcher(); 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); } }