deotalandAi/packages/ui/plugins/charts/index.js

37 lines
799 B
JavaScript

// 图表插件主入口
export { default as ChartPlugin } from './ChartPlugin.vue'
// 插件配置信息
export const chartPluginConfig = {
name: '@deotaland/ui-charts',
version: '1.0.0',
dependencies: {
'chart.js': '^4.4.0',
'vue-chartjs': '^5.2.0'
}
}
// 快速使用示例
export const createSampleChart = (type = 'line') => {
return {
type,
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June'],
datasets: [{
label: 'Sales',
data: [65, 59, 80, 81, 56, 55],
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true
}
}
}
}
}