diff --git a/src/components/chart/Chart.d.ts b/src/components/chart/Chart.d.ts index bbcf9742e..95a1c6f77 100755 --- a/src/components/chart/Chart.d.ts +++ b/src/components/chart/Chart.d.ts @@ -1,17 +1,94 @@ -interface ChartProps { - type?: string; - data?: object; - options?: object; - width?: number; - height?: number; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; + +export interface ChartSelectEvent { + /** + * Browser event. + */ + originalEvent: Event; + /** + * Selected element. + */ + element: HTMLElement | any; + /** + * Selected dataset. + */ + dataset: any; } -declare class Chart { - $props: ChartProps; - $emit(eventName: 'select', e: { originalEvent: Event, element: any, dataset: any }): this; - refresh(): void; - reinit(): void; - generateLegend(): void | any; +export interface ChartProps { + /** + * Type of the chart. + */ + type?: string | undefined; + /** + * Data to display. + */ + data?: object | undefined; + /** + * Options to customize the chart. + */ + options?: object | undefined; + /** + * Width of the chart in non-responsive mode. + * Default value is 300. + */ + width?: number | undefined; + /** + * Height of the chart in non-responsive mode. + * Default value is 150. + */ + height?: number | undefined; } +export interface ChartSlots { +} + +export declare type ChartEmits = { + /** + * Callback to invoke when a tab gets expanded. + * @param {ChartSelectEvent} event - Custom select event. + */ + 'select': (event: ChartSelectEvent) => void; +} + +declare class Chart extends ClassComponent { + /** + * Redraws the graph. + * + * @memberof Chart + */ + refresh: () => void; + /** + * Destroys the graph first and then creates it again. + * + * @memberof Chart + */ + reinit: () => void; + /** + * Returns an HTML string of a legend for that chart. The legend is generated from the legendCallback in the options. + * + * @memberof Chart + */ + generateLegend: () => string | any; +} + +declare module '@vue/runtime-core' { + interface GlobalComponents { + Chart: GlobalComponentConstructor + } +} + +/** + * + * Chart components are based on Charts.js, an open source HTML5 based charting library. + * + * Helper API; + * + * - [Chart.js](https://www.chartjs.org/) + * + * Demos: + * + * - [Chart](https://www.primefaces.org/primevue/showcase/#/chart) + * + */ export default Chart;