primevue-mirror/components/chart/Chart.d.ts

114 lines
2.5 KiB
TypeScript
Raw Normal View History

2022-12-08 11:04:25 +00:00
import { CanvasHTMLAttributes } from 'vue';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export interface ChartSelectEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Selected element.
*/
element: HTMLElement | any;
/**
* Selected dataset.
*/
dataset: 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;
/**
* Used to custom plugins of the chart.
*/
plugins?: any;
/**
* 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;
2022-12-08 11:04:25 +00:00
/**
* Uses to pass all properties of the CanvasHTMLAttributes to canvas element inside the component.
*/
canvasProps?: CanvasHTMLAttributes | undefined;
2022-09-06 12:03:37 +00:00
}
2022-09-14 11:26:01 +00:00
export interface ChartSlots {}
2022-09-06 12:03:37 +00:00
export declare type ChartEmits = {
/**
* Callback to invoke when a tab gets expanded.
* @param {ChartSelectEvent} event - Custom select event.
*/
2022-09-14 11:26:01 +00:00
select: (event: ChartSelectEvent) => void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when chart is loaded.
* @param {*} chart - Chart instance.
*/
2022-09-14 11:26:01 +00:00
loaded: (chart: any) => void;
};
2022-09-06 12:03:37 +00:00
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;
/**
* Returns Chart instance.
*
* @memberof Chart
*/
getChart: () => any;
}
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Chart: GlobalComponentConstructor<Chart>;
2022-09-06 12:03:37 +00:00
}
}
/**
*
* Chart components are based on Charts.js, an open source HTML5 based charting library.
*
* Helper API;
*
* - [Chart.js](https://www.chartjs.org/)
*
* Demos:
*
2022-09-14 11:26:01 +00:00
* - [Chart](https://www.primefaces.org/primevue/chart)
2022-09-06 12:03:37 +00:00
*
*/
export default Chart;