-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* @Author: liuhua | ||
* @Date: 2023-07-04 10:10:20 | ||
* @LastEditors: liuhua | ||
* @LastEditTime: 2023-07-04 10:46:58 | ||
* @Description: echarts按需引入 | ||
*/ | ||
|
||
import * as echarts from 'echarts/core'; | ||
import { BarChart, LineChart } from 'echarts/charts'; | ||
import { | ||
TitleComponent, | ||
TooltipComponent, | ||
GridComponent, | ||
// 数据集组件 | ||
DatasetComponent, | ||
// 内置数据转换器组件 (filter, sort) | ||
TransformComponent | ||
} from 'echarts/components'; | ||
import { LabelLayout, UniversalTransition } from 'echarts/features'; | ||
import { CanvasRenderer } from 'echarts/renderers'; | ||
import type { | ||
// 系列类型的定义后缀都为 SeriesOption | ||
BarSeriesOption, | ||
LineSeriesOption | ||
} from 'echarts/charts'; | ||
import type { | ||
// 组件类型的定义后缀都为 ComponentOption | ||
TitleComponentOption, | ||
TooltipComponentOption, | ||
GridComponentOption, | ||
DatasetComponentOption | ||
} from 'echarts/components'; | ||
import type { ComposeOption } from 'echarts/core'; | ||
|
||
// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型 | ||
export type ECOption = ComposeOption< | ||
| BarSeriesOption | ||
| LineSeriesOption | ||
| TitleComponentOption | ||
| TooltipComponentOption | ||
| GridComponentOption | ||
| DatasetComponentOption | ||
>; | ||
|
||
// 注册必须的组件 | ||
echarts.use([ | ||
TitleComponent, | ||
TooltipComponent, | ||
GridComponent, | ||
DatasetComponent, | ||
TransformComponent, | ||
BarChart, | ||
LineChart, | ||
LabelLayout, | ||
UniversalTransition, | ||
CanvasRenderer | ||
]); | ||
export default echarts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters