Files
akbleserver/uni_modules/ak-charts/interface.uts
2026-03-16 10:37:46 +08:00

46 lines
1.1 KiB
Plaintext

/**
* ak-charts UTS 插件主入口
* 提供注册和渲染图表的基础接口
*/
export type ChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'radar';
export type ChartSeries = {
name: string;
data: number[];
color?: string;
};
export type ChartOption = {
type: ChartType;
data?: number[];
series?: ChartSeries[]; // 新增
labels?: string[];
color?: string | string[];
centerX?: number;
centerY?: number;
radius?: number;
innerRadius?: number; // 环形图内圆半径
}
export type Margin {
top: number;
right: number;
bottom: number;
left: number;
}
export class AkCharts {
// 注册图表(可扩展)
static register(type: ChartType, render: Function): void {
// 这里可以实现自定义图表类型注册
}
// 渲染图表(实际渲染由组件完成)
static render(option: ChartOption, canvasId: string): void {
// 这里只做参数校验和分发,实际渲染由 ak-charts.vue 组件实现
// 可通过 uni.$emit/uni.$on 或全局事件通信
uni.$emit('ak-charts-render', { option, canvasId });
}
}
export default AkCharts;