diff --git a/web/src/management/hooks/useCharts.js b/web/src/management/hooks/useCharts.js index e15583f7..089d59ac 100644 --- a/web/src/management/hooks/useCharts.js +++ b/web/src/management/hooks/useCharts.js @@ -1,6 +1,25 @@ -import * as echarts from 'echarts' +import * as echarts from 'echarts/core' +import { BarChart, PieChart, GaugeChart } from 'echarts/charts' +import { + TooltipComponent, + TitleComponent, + GridComponent, + LegendComponent +} from 'echarts/components' +import { CanvasRenderer } from 'echarts/renderers' import { getOption } from '@/management/config/chartConfig' +echarts.use([ + TitleComponent, + TooltipComponent, + GridComponent, + LegendComponent, + BarChart, + PieChart, + GaugeChart, + CanvasRenderer +]) + /** * 绘制图表 * @param {Object} el