Initial commit of akmon project
This commit is contained in:
41
uni_modules/ak-charts/interface.uts
Normal file
41
uni_modules/ak-charts/interface.uts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* ak-charts UTS 插件主入口
|
||||
* 提供注册和渲染图表的基础接口
|
||||
*/
|
||||
|
||||
export type ChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'area' | 'horizontalBar' | 'multi';
|
||||
|
||||
export type ChartOption {
|
||||
type: ChartType;
|
||||
data: number[] | number[][];
|
||||
labels?: string[];
|
||||
color?: string | string[]; // 支持单色或多色配置
|
||||
seriesNames?: string[];
|
||||
seriesAxis?: 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: any): 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;
|
||||
Reference in New Issue
Block a user