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

173 lines
3.8 KiB
TypeScript
Raw Normal View History

2023-03-01 12:59:22 +00:00
/**
*
* Chart groups a collection of contents in tabs.
*
* [Live Demo](https://www.primevue.org/chart/)
*
* @module chart
*
*/
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';
2023-05-02 07:18:02 +00:00
export declare type ChartPassThroughOptionType = ChartPassThroughAttributes | ((options: ChartPassThroughMethodOptions) => ChartPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface ChartPassThroughMethodOptions {
props: ChartProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link ChartProps.pt}
*/
export interface ChartPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: ChartPassThroughOptionType;
/**
* Uses to pass attributes to the canvas's DOM element.
*/
canvas?: ChartPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface ChartPassThroughAttributes {
[key: string]: any;
}
2023-03-01 12:59:22 +00:00
/**
* Custom select event.
2023-03-06 20:35:39 +00:00
* @see {@link ChartEmits.select}
2023-03-01 12:59:22 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface ChartSelectEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Selected element.
*/
element: HTMLElement | any;
/**
* Selected dataset.
*/
dataset: any;
}
2023-03-01 12:59:22 +00:00
/**
* Defines valid properties in Chart component.
*/
2022-09-06 12:03:37 +00:00
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.
2023-03-01 12:59:47 +00:00
* @defaultValue 300
2022-09-06 12:03:37 +00:00
*/
width?: number | undefined;
/**
* Height of the chart in non-responsive mode.
2023-03-01 12:59:47 +00:00
* @defaultValue 150
2022-09-06 12:03:37 +00:00
*/
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;
2023-05-02 07:18:02 +00:00
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {ChartPassThroughOptions}
*/
pt?: ChartPassThroughOptions;
2023-05-31 06:44:48 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
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
2023-03-01 12:59:22 +00:00
/**
* Defines valid emits in Chart component.
*/
export interface ChartEmits {
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a tab gets expanded.
* @param {ChartSelectEvent} event - Custom select event.
*/
2023-03-01 12:59:22 +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.
*/
2023-03-01 12:59:22 +00:00
loaded(chart: any): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 12:59:22 +00:00
/**
* **PrimeVue - Chart**
*
* _Chart groups a collection of contents in tabs._
*
* [Live Demo](https://www.primevue.org/chart/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 12:59:22 +00:00
*
* @group Component
*
*/
2022-09-06 12:03:37 +00:00
declare class Chart extends ClassComponent<ChartProps, ChartSlots, ChartEmits> {
/**
* Redraws the graph.
*
* @memberof Chart
*/
2023-03-01 12:59:22 +00:00
refresh(): void;
2022-09-06 12:03:37 +00:00
/**
* Destroys the graph first and then creates it again.
*
* @memberof Chart
*/
2023-03-01 12:59:22 +00:00
reinit(): void;
2022-09-06 12:03:37 +00:00
/**
* Returns an HTML string of a legend for that chart. The legend is generated from the legendCallback in the options.
*
* @memberof Chart
*/
2023-03-01 12:59:22 +00:00
generateLegend(): string | any;
2022-09-06 12:03:37 +00:00
/**
* Returns Chart instance.
*
* @memberof Chart
*/
2023-03-01 12:59:22 +00:00
getChart(): any;
2022-09-06 12:03:37 +00:00
}
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
}
}
export default Chart;