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

180 lines
4.0 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';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type ChartPassThroughOptionType = ChartPassThroughAttributes | ((options: ChartPassThroughMethodOptions) => ChartPassThroughAttributes | string) | string | null | undefined;
2023-05-02 07:18:02 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface ChartPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-05-02 07:18:02 +00:00
props: ChartProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link ChartProps.pt}
*/
export interface ChartPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-02 07:18:02 +00:00
*/
root?: ChartPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the canvas's DOM element.
2023-05-02 07:18:02 +00:00
*/
canvas?: ChartPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to manage all lifecycle hooks
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-05-02 07:18:02 +00:00
}
/**
* 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
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the CanvasHTMLAttributes to canvas element inside the component.
2022-12-08 11:04:25 +00:00
*/
canvasProps?: CanvasHTMLAttributes | undefined;
2023-05-02 07:18:02 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-02 07:18:02 +00:00
* @type {ChartPassThroughOptions}
*/
pt?: PTOptions<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;