feat: 添加条形统计图模板
This commit is contained in:
22
src/hooks/chart/data/bar.ts
Normal file
22
src/hooks/chart/data/bar.ts
Normal 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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
|
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
|
||||||
import type { ComposeOption } from 'echarts/core';
|
import type { ComposeOption } from 'echarts/core';
|
||||||
import * as echarts 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
|
// 组件类型的定义后缀都为 ComponentOption
|
||||||
import type {
|
import type {
|
||||||
DatasetComponentOption,
|
DatasetComponentOption,
|
||||||
@@ -30,6 +30,7 @@ import { SVGRenderer } from 'echarts/renderers';
|
|||||||
// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
|
// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
|
||||||
type ECOption = ComposeOption<
|
type ECOption = ComposeOption<
|
||||||
| PieSeriesOption
|
| PieSeriesOption
|
||||||
|
| BarSeriesOption
|
||||||
| TitleComponentOption
|
| TitleComponentOption
|
||||||
| TooltipComponentOption
|
| TooltipComponentOption
|
||||||
| GridComponentOption
|
| GridComponentOption
|
||||||
@@ -48,6 +49,7 @@ echarts.use([
|
|||||||
UniversalTransition,
|
UniversalTransition,
|
||||||
SVGRenderer,
|
SVGRenderer,
|
||||||
PieChart,
|
PieChart,
|
||||||
|
BarChart,
|
||||||
LegendComponent
|
LegendComponent
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user