Fixed #1836 - For Chart

pull/1846/head
mertsincan 2021-12-01 15:35:33 +03:00
parent ffa99074c1
commit 2a62d2696a
1 changed files with 89 additions and 12 deletions

View File

@ -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<ChartProps, ChartSlots, ChartEmits> {
/**
* 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>
}
}
/**
*
* 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;