88
99import { ElLoading } from "element-plus"
1010import { type Ref , onMounted , ref , isRef , watch } from "vue"
11- import { init , type ECharts } from "echarts"
11+ import { AriaComponentOption , ComposeOption , init , ECharts } from "echarts"
1212import { useWindowSize } from "@vueuse/core"
13+ import accessibilityHelper from "@service/components/accessibility-helper"
14+
15+ type BaseEchartsOption = ComposeOption < AriaComponentOption >
16+
17+ export const generateAriaOption = async ( ) : Promise < AriaComponentOption > => {
18+ const { chartDecal } = await accessibilityHelper . getOption ( ) || { }
19+ if ( ! chartDecal ) {
20+ return { enabled : false }
21+ }
22+ const color = "rgba(0, 0, 0, 0.2)"
23+ return {
24+ enabled : true ,
25+ decal : {
26+ show : true ,
27+ decals : [ {
28+ color,
29+ dashArrayX : [ 1 , 0 ] ,
30+ dashArrayY : [ 2 , 5 ] ,
31+ rotation : .5235987755982988 ,
32+ } , {
33+ color,
34+ symbol : 'circle' ,
35+ dashArrayX : [ [ 8 , 8 ] , [ 0 , 8 , 8 , 0 ] ] ,
36+ dashArrayY : [ 6 , 0 ] ,
37+ symbolSize : .8 ,
38+ } , {
39+ color,
40+ dashArrayX : [ 1 , 0 ] ,
41+ dashArrayY : [ 4 , 3 ] ,
42+ rotation : - .7853981633974483
43+ } , {
44+ color,
45+ dashArrayX : [ [ 6 , 6 ] , [ 0 , 6 , 6 , 0 ] ] ,
46+ dashArrayY : [ 6 , 0 ] ,
47+ } , {
48+ color,
49+ dashArrayX : [ [ 1 , 0 ] , [ 1 , 6 ] ] ,
50+ dashArrayY : [ 1 , 0 , 6 , 0 ] ,
51+ rotation : .7853981633974483 ,
52+ } , {
53+ color,
54+ symbol : 'triangle' ,
55+ dashArrayX : [ [ 9 , 9 ] , [ 0 , 9 , 9 , 0 ] ] ,
56+ dashArrayY : [ 7 , 2 ] ,
57+ symbolSize : .75 ,
58+ } ]
59+ }
60+ }
61+ }
1362
1463export abstract class EchartsWrapper < BizOption , EchartsOption > {
1564 protected instance : ECharts
@@ -32,8 +81,10 @@ export abstract class EchartsWrapper<BizOption, EchartsOption> {
3281
3382 private async innerRender ( ) {
3483 const biz = this . lastBizOption
35- const option = await this . generateOption ( biz )
84+ const option = await this . generateOption ( biz ) as ( EchartsOption & BaseEchartsOption )
3685 if ( ! option ) return
86+ const aria = await generateAriaOption ( )
87+ option . aria = aria
3788 this . instance . setOption ( option , { notMerge : false } )
3889 }
3990
0 commit comments