UNPKG

igniteui-angular-charts

Version:

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

166 lines (165 loc) 7.49 kB
import { __extends } from "tslib"; import { Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Input } from '@angular/core'; import { AngularRenderer } from "igniteui-angular-core"; import { TypeRegistrar } from "igniteui-angular-core"; import { IgxPieChartBaseComponent } from './igx-pie-chart-base-component'; import { DataChartStylingDefaults } from './DataChartStylingDefaults'; import { XamPieChart } from './XamPieChart'; import { NamePatcher } from "igniteui-angular-core"; import * as i0 from "@angular/core"; /** * Represents Infragistics IgxPieChartComponent control. */ var IgxPieChartComponent = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgxPieChartComponent, _super); function IgxPieChartComponent(renderer, _elRef, ngZone, injector, componentFactoryResolver) { var _this = _super.call(this) || this; _this.renderer = renderer; _this._elRef = _elRef; _this.ngZone = ngZone; _this.injector = injector; _this.componentFactoryResolver = componentFactoryResolver; _this._root = null; _this._dataSource = null; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._zoneRunner = function (act) { return ngZone.run(act); }; _this.container = renderer.createElement("div"); renderer.appendChild(_elRef.element.nativeElement, _this.container); renderer.setStyle(_this.container, "display", "block"); renderer.setStyle(_this.container, "width", "100%"); renderer.setStyle(_this.container, "height", "100%"); var root; root = _this.container; if (_this.container != null) { root = _this.container; } _this._root = root; var ren = new AngularRenderer(root, _this.renderer, window.document, _this.ngZone, true, DataChartStylingDefaults); _this._wrapper = ren; var chart = _this.i; _this._chart = chart; chart.provideContainer(ren); _this.bindData(); chart.notifyContainerResized(); ren.addSizeWatcher(function () { _this._chart.notifyContainerResized(); }); return _this; } Object.defineProperty(IgxPieChartComponent.prototype, "height", { get: function () { return this._height; }, set: function (value) { this._height = value; this.renderer.setStyle(this._elRef.element.nativeElement, "height", value); this._chart.notifyContainerResized(); }, enumerable: false, configurable: true }); Object.defineProperty(IgxPieChartComponent.prototype, "width", { get: function () { return this._width; }, set: function (value) { this._width = value; this.renderer.setStyle(this._elRef.element.nativeElement, "width", value); this._chart.notifyContainerResized(); }, enumerable: false, configurable: true }); IgxPieChartComponent.prototype.ngAfterViewInit = function () { this.updateStyle(); this.i.notifyContainerResized(); }; IgxPieChartComponent.prototype.ngOnDestroy = function () { this._chart.destroy(); this._wrapper.destroy(); }; IgxPieChartComponent.prototype.updateStyle = function () { this._styling(this._root, this); }; IgxPieChartComponent.prototype.createImplementation = function () { return new XamPieChart(); }; Object.defineProperty(IgxPieChartComponent.prototype, "i", { get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgxPieChartComponent.prototype.createSeriesComponent = function (type) { if (TypeRegistrar.isRegistered(type)) { var s = TypeRegistrar.create(type); s.owner = this; s._provideRenderer(this.renderer); return s; } else { //we shouldn't get here, hopefully. throw Error("series type not loaded: " + type); } }; Object.defineProperty(IgxPieChartComponent.prototype, "dataSource", { get: function () { return this._dataSource; }, set: function (value) { this._dataSource = value; this.bindData(); }, enumerable: false, configurable: true }); IgxPieChartComponent.prototype.bindData = function () { if (this._chart != null && this._chart !== undefined) { this._chart.itemsSource = this._dataSource; } }; Object.defineProperty(IgxPieChartComponent.prototype, "legend", { /** * Gets or sets the legend used for the current chart. */ get: function () { if (this.i.legend != null) return this.i.legend.externalObject; }, set: function (v) { if (v != undefined && v != null) this.i.legend = v.i; }, enumerable: false, configurable: true }); IgxPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxPieChartComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); IgxPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxPieChartComponent, selector: "igx-pie-chart", inputs: { height: "height", width: "width", dataSource: "dataSource", legend: "legend" }, host: { classAttribute: "ig-pie-chart igx-pie-chart" }, providers: [], viewQueries: [{ propertyName: "_dynamicContent", first: true, predicate: ["dynamicContent"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-container #dynamicContent></ng-container>", isInline: true, styles: ["\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); return IgxPieChartComponent; }(IgxPieChartBaseComponent)); export { IgxPieChartComponent }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxPieChartComponent, decorators: [{ type: Component, args: [{ selector: 'igx-pie-chart', template: "<ng-container #dynamicContent></ng-container>", changeDetection: ChangeDetectionStrategy.OnPush, providers: [], host: { 'class': 'ig-pie-chart igx-pie-chart' }, styles: ["\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t}\n\t"] }] }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { _dynamicContent: [{ type: ViewChild, args: ["dynamicContent", { read: ViewContainerRef, static: true }] }], height: [{ type: Input }], width: [{ type: Input }], dataSource: [{ type: Input }], legend: [{ type: Input }] } });