primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("chart.js")):"function"==typeof define&&define.amd?define("primeng/chart",["exports","@angular/core","@angular/common","chart.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).primeng=t.primeng||{},t.primeng.chart={}),t.ng.core,t.ng.common,t.Chart)}(this,(function(t,e,n,i){"use strict";function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var o=r(i),a=function(){function t(t){this.el=t,this.plugins=[],this.responsive=!0,this.onDataSelect=new e.EventEmitter,this._options={}}return Object.defineProperty(t.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t,this.reinit()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},set:function(t){this._options=t,this.reinit()},enumerable:!1,configurable:!0}),t.prototype.ngAfterViewInit=function(){this.initChart(),this.initialized=!0},t.prototype.onCanvasClick=function(t){if(this.chart){var e=this.chart.getElementAtEvent(t),n=this.chart.getDatasetAtEvent(t);e&&e[0]&&n&&this.onDataSelect.emit({originalEvent:t,element:e[0],dataset:n})}},t.prototype.initChart=function(){var t=this.options||{};t.responsive=this.responsive,t.responsive&&(this.height||this.width)&&(t.maintainAspectRatio=!1),this.chart=new o(this.el.nativeElement.children[0].children[0],{type:this.type,data:this.data,options:this.options,plugins:this.plugins})},t.prototype.getCanvas=function(){return this.el.nativeElement.children[0].children[0]},t.prototype.getBase64Image=function(){return this.chart.toBase64Image()},t.prototype.generateLegend=function(){if(this.chart)return this.chart.generateLegend()},t.prototype.refresh=function(){this.chart&&this.chart.update()},t.prototype.reinit=function(){this.chart&&(this.chart.destroy(),this.initChart())},t.prototype.ngOnDestroy=function(){this.chart&&(this.chart.destroy(),this.initialized=!1,this.chart=null)},t}();a.decorators=[{type:e.Component,args:[{selector:"p-chart",template:'\n <div style="position:relative" [style.width]="responsive && !width ? null : width" [style.height]="responsive && !height ? null : height">\n <canvas [attr.width]="responsive && !width ? null : width" [attr.height]="responsive && !height ? null : height" (click)="onCanvasClick($event)"></canvas>\n </div>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],a.ctorParameters=function(){return[{type:e.ElementRef}]},a.propDecorators={type:[{type:e.Input}],plugins:[{type:e.Input}],width:[{type:e.Input}],height:[{type:e.Input}],responsive:[{type:e.Input}],onDataSelect:[{type:e.Output}],data:[{type:e.Input}],options:[{type:e.Input}]};var s=function(){};s.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule],exports:[a],declarations:[a]}]}],t.ChartModule=s,t.UIChart=a,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-chart.umd.min.js.map