feat: 添加条形统计图模板

This commit is contained in:
Huangzhe
2025-05-29 15:15:42 +08:00
parent b1fb42668c
commit 0173b0b05e
2 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
export const barOption = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {},
yAxis: {
type: 'category',
data: []
},
xAxis: {
type: 'value'
},
series: [
{
data: [],
type: 'bar'
}
]
};

View File

@@ -1,9 +1,9 @@
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
import type { ComposeOption } from 'echarts/core';
import * as echarts from 'echarts/core';
import type { PieSeriesOption } from 'echarts/charts';
import type { BarSeriesOption, PieSeriesOption } from 'echarts/charts';
// 引入 饼状图
import { PieChart } from 'echarts/charts';
import { PieChart, BarChart} from 'echarts/charts';
// 组件类型的定义后缀都为 ComponentOption
import type {
DatasetComponentOption,
@@ -30,6 +30,7 @@ import { SVGRenderer } from 'echarts/renderers';
// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
type ECOption = ComposeOption<
| PieSeriesOption
| BarSeriesOption
| TitleComponentOption
| TooltipComponentOption
| GridComponentOption
@@ -48,6 +49,7 @@ echarts.use([
UniversalTransition,
SVGRenderer,
PieChart,
BarChart,
LegendComponent
]);