Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-chart.mjs.map

1 line
10 KiB
Plaintext
Raw Normal View History

2024-07-16 15:23:22 +00:00
{"version":3,"file":"primeng-chart.mjs","sources":["../../src/app/components/chart/chart.ts","../../src/app/components/chart/primeng-chart.ts"],"sourcesContent":["import { NgModule, Component, ElementRef, AfterViewInit, OnDestroy, Input, Output, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, Inject, PLATFORM_ID, NgZone, booleanAttribute } from '@angular/core';\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\nimport Chart from 'chart.js/auto';\n/**\n * Chart groups a collection of contents in tabs.\n * @group Components\n */\n@Component({\n selector: 'p-chart',\n template: `\n <div style=\"position:relative\" [style.width]=\"responsive && !width ? null : width\" [style.height]=\"responsive && !height ? null : height\">\n <canvas role=\"img\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledBy\" [attr.width]=\"responsive && !width ? null : width\" [attr.height]=\"responsive && !height ? null : height\" (click)=\"onCanvasClick($event)\"></canvas>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'p-element'\n }\n})\nexport class UIChart implements AfterViewInit, OnDestroy {\n /**\n * Type of the chart.\n * @group Props\n */\n @Input() type: string | undefined;\n /**\n * Array of per-chart plugins to customize the chart behaviour.\n * @group Props\n */\n @Input() plugins: any[] = [];\n /**\n * Width of the chart.\n * @group Props\n */\n @Input() width: string | undefined;\n /**\n * Height of the chart.\n * @group Props\n */\n @Input() height: string | undefined;\n /**\n * Whether the chart is redrawn on screen size change.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) responsive: boolean = true;\n /**\n * Used to define a string that autocomplete attribute the current element.\n * @group Props\n */\n @Input() ariaLabel: string | undefined;\n /**\n * Establishes relationships between the component and label(s) where its value should be one or more element IDs.\n * @group Props\n */\n @Input() ariaLabelledBy: string | undefined;\n /**\n * Data to display.\n * @group Props\n */\n @Input() get data(): any {\n return this._data;\n }\n set data(val: any) {\n this._data = val;\n this.reinit();\n }\n /**\n * Options to customize the chart.\n * @group Props\n */\n @Input() get options(): any {\n return this._options;\n }\n set options(val: any) {\n this._options = val;\n this.reinit();\n }\n /**\n * Callback to execute when an element on chart is clicked.\n * @group Emits\n */\n @Output() onDataSelect: EventEmitter<any> = new EventEmitter<any>();\n\n isBrowser: boolean = false;\n\n initialized: boolean | undefined;\n\n _data: any;\n\n _options: any = {};\n\n chart: any;\n\n constructor(@Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, private zone: NgZone) {}\n\n ngAfterViewInit() {\n this.initChart();\n this.initialized = true;\n }\n\n onCanvasClick(event: Event) {\n if (this.chart) {\n const element = this.chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);\n const dataset = this.chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);\n\n if (element && element[0] && dataset) {\n this.onDataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });\n }\n }\n }\n\n initChart() {\n if (isPlatformBrowser(this.platformId)) {\n let opts = this.options || {};\n opts.responsive = this.responsive;\n\n // allows chart to resize in responsive mode\n if (opts.responsive && (this.height || this.width)) {\n opts.maintainAspectRatio = false;\n