@@ -148,95 +148,95 @@ export function getEchartsConfig(
148
148
149
149
if ( props . mode === "json" ) {
150
150
let opt = {
151
- "title" : {
152
- "text" : props . echartsTitle ,
153
- 'top' : props . echartsLegendConfig . top === 'bottom' ?'top' :'bottom' ,
154
- "left" :props . echartsTitleConfig . top ,
155
- "textStyle" : {
156
- "fontFamily" : props ?. titleStyle ?. chartFontFamily || theme ?. titleStyle ?. fontFamily ,
157
- "fontSize" : props ?. titleStyle ?. chartTextSize || theme ?. titleStyle ?. fontSize || '18' ,
158
- "fontWeight" : props ?. titleStyle ?. chartTextWeight || theme ?. titleStyle ?. fontWeight ,
159
- "color" : props ?. titleStyle ?. chartTextColor || theme ?. titleStyle ?. fontColor || "#000000" ,
160
- "fontStyle" : props ?. titleStyle ?. chartFontStyle || theme ?. titleStyle ?. fontStyle ,
161
- "textShadowColor" : props ?. titleStyle ?. chartShadowColor || theme ?. titleStyle ?. shadowColor ,
162
- "textShadowBlur" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. titleStyle ?. boxShadow . split ( 'px' ) [ 0 ] ,
163
- "textShadowOffsetX" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. titleStyle ?. boxShadow . split ( 'px' ) [ 1 ] ,
164
- "textShadowOffsetY" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. titleStyle ?. boxShadow . split ( 'px' ) [ 2 ]
165
- }
166
- } ,
167
- "backgroundColor" : gradientColor && backgroundColor
168
- ? {
169
- "x" : direction ?. split ( ' ' ) [ 0 ] ,
170
- "y" : direction ?. split ( ' ' ) [ 1 ] ,
171
- "x2" : direction ?. split ( ' ' ) [ 2 ] ,
172
- "y2" : direction ?. split ( ' ' ) [ 3 ] ,
173
- "colorStops" : [
174
- { "offset" : 0 , "color" : backgroundColor + opacityToHex ( opacity ) } ,
175
- { "offset" : 1 , "color" : gradientColor + opacityToHex ( opacity ) }
176
- ]
177
- }
178
- : backgroundColor + opacityToHex ( opacity ) ,
179
- "color" : props . echartsOption . data ?. map ( data => data . color ) ,
180
- "tooltip" : props . tooltip && {
181
- "trigger" : "item" ,
182
- "formatter" : "{a} <br/>{b} : {c}%"
183
- } ,
184
- "legend" :props . legendVisibility && {
185
- "data" : props . echartsOption . data ?. map ( data => data . name ) ,
186
- "top" : props . echartsLegendConfig . top ,
187
- "textStyle" : {
188
- "fontFamily" : props ?. legendStyle ?. chartFontFamily || theme ?. legendStyle ?. fontFamily ,
189
- "fontSize" : props ?. legendStyle ?. chartTextSize || theme ?. legendStyle ?. fontSize ,
190
- "fontWeight" : props ?. legendStyle ?. chartTextWeight || theme ?. legendStyle ?. fontWeight ,
191
- "color" : props ?. legendStyle ?. chartTextColor || theme ?. legendStyle ?. fontColor || "#000000" ,
192
- "fontStyle" : props ?. legendStyle ?. chartFontStyle || theme ?. legendStyle ?. fontStyle ,
193
- "textShadowColor" : props ?. legendStyle ?. chartShadowColor || theme ?. legendStyle ?. shadowColor ,
194
- "textShadowBlur" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. legendStyle ?. boxShadow . split ( 'px' ) [ 0 ] ,
195
- "textShadowOffsetX" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. legendStyle ?. boxShadow . split ( 'px' ) [ 1 ] ,
196
- "textShadowOffsetY" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. legendStyle ?. boxShadow . split ( 'px' ) [ 2 ]
197
- }
198
- } ,
199
- "series" : [
200
- {
201
- "name" : props . echartsConfig . type ,
202
- "type" : props . echartsConfig . type ,
203
- "left" : `${ props . left } %` ,
204
- "top" : props . top ,
205
- "bottom" : props . bottom ,
206
- "width" : `${ props . left } %` ,
207
- "min" : props . min ,
208
- "max" : props . max ,
209
- "gap" : props . gap ,
210
- "funnelAlign" : props . echartsFunnelAlignConfig . funnelAlign ,
211
- "sort" : props . echartsSortingConfig . sort ,
212
- "itemStyle" : {
213
- "opacity" : props . opacity ,
214
- "borderColor" : props ?. chartStyle ?. chartBorderColor || theme ?. chartStyle ?. borderColor ,
215
- "borderWidth" : props ?. chartStyle ?. chartBorderWidth || theme ?. chartStyle ?. borderWidth ,
216
- "borderType" : props ?. chartStyle ?. chartBorderStyle || theme ?. chartStyle ?. borderType ,
217
- "borderRadius" : props ?. chartStyle ?. chartBorderRadius || theme ?. chartStyle ?. borderRadius ,
218
- "shadowColor" : props ?. chartStyle ?. chartShadowColor || theme ?. chartStyle ?. shadowColor ,
219
- "shadowBlur" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px' ) [ 0 ] ,
220
- "shadowOffsetX" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px' ) [ 1 ] ,
221
- "shadowOffsetY" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px' ) [ 2 ]
151
+ "title" : {
152
+ "text" : props . echartsTitle ,
153
+ 'top' : props . echartsLegendConfig . top === 'bottom' ?'top' :'bottom' ,
154
+ "left" :props . echartsTitleConfig . top ,
155
+ "textStyle" : {
156
+ "fontFamily" : props ?. titleStyle ?. chartFontFamily || theme ?. titleStyle ?. fontFamily ,
157
+ "fontSize" : props ?. titleStyle ?. chartTextSize || theme ?. titleStyle ?. fontSize || '18' ,
158
+ "fontWeight" : props ?. titleStyle ?. chartTextWeight || theme ?. titleStyle ?. fontWeight ,
159
+ "color" : props ?. titleStyle ?. chartTextColor || theme ?. titleStyle ?. fontColor || "#000000" ,
160
+ "fontStyle" : props ?. titleStyle ?. chartFontStyle || theme ?. titleStyle ?. fontStyle ,
161
+ "textShadowColor" : props ?. titleStyle ?. chartShadowColor || theme ?. titleStyle ?. shadowColor ,
162
+ "textShadowBlur" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] ,
163
+ "textShadowOffsetX" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] ,
164
+ "textShadowOffsetY" : props ?. titleStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 2 ]
165
+ }
222
166
} ,
223
- "label" : {
224
- "show" : props . label ,
225
- "position" : props . echartsLabelConfig . top ,
226
- "fontFamily" : props ?. labelStyle ?. chartFontFamily || theme ?. labelStyle ?. fontFamily ,
227
- "fontSize" : props ?. labelStyle ?. chartTextSize || theme ?. labelStyle ?. fontSize ,
228
- "fontWeight" : props ?. labelStyle ?. chartTextWeight || theme ?. labelStyle ?. fontWeight ,
229
- "color" : props ?. labelStyle ?. chartTextColor || theme ?. labelStyle ?. fontColor || "#000000" ,
230
- "fontStyle" : props ?. labelStyle ?. chartFontStyle || theme ?. labelStyle ?. fontStyle ,
231
- "textShadowColor" : props ?. labelStyle ?. chartShadowColor || theme ?. labelStyle ?. shadowColor ,
232
- "textShadowBlur" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. labelStyle ?. boxShadow . split ( 'px' ) [ 0 ] ,
233
- "textShadowOffsetX" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. labelStyle ?. boxShadow . split ( 'px' ) [ 1 ] ,
234
- "textShadowOffsetY" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. labelStyle ?. boxShadow . split ( 'px' ) [ 2 ]
167
+ "backgroundColor" : gradientColor && backgroundColor
168
+ ? {
169
+ "x" : direction ?. split ( ' ' ) [ 0 ] ,
170
+ "y" : direction ?. split ( ' ' ) [ 1 ] ,
171
+ "x2" : direction ?. split ( ' ' ) [ 2 ] ,
172
+ "y2" : direction ?. split ( ' ' ) [ 3 ] ,
173
+ "colorStops" : [
174
+ { "offset" : 0 , "color" : backgroundColor + opacityToHex ( opacity ) } ,
175
+ { "offset" : 1 , "color" : gradientColor + opacityToHex ( opacity ) }
176
+ ]
177
+ }
178
+ : backgroundColor + opacityToHex ( opacity ) ,
179
+ "color" : props . echartsOption . data ?. map ( data => data . color ) ,
180
+ "tooltip" : props . tooltip && {
181
+ "trigger" : "item" ,
182
+ "formatter" : "{a} <br/>{b} : {c}%"
235
183
} ,
236
- "data" : props . echartsOption . data
184
+ "legend" :props . legendVisibility && {
185
+ "data" : props . echartsOption . data ?. map ( data => data . name ) ,
186
+ "top" : props . echartsLegendConfig . top ,
187
+ "textStyle" : {
188
+ "fontFamily" : props ?. legendStyle ?. chartFontFamily || theme ?. legendStyle ?. fontFamily ,
189
+ "fontSize" : props ?. legendStyle ?. chartTextSize || theme ?. legendStyle ?. fontSize ,
190
+ "fontWeight" : props ?. legendStyle ?. chartTextWeight || theme ?. legendStyle ?. fontWeight ,
191
+ "color" : props ?. legendStyle ?. chartTextColor || theme ?. legendStyle ?. fontColor || "#000000" ,
192
+ "fontStyle" : props ?. legendStyle ?. chartFontStyle || theme ?. legendStyle ?. fontStyle ,
193
+ "textShadowColor" : props ?. legendStyle ?. chartShadowColor || theme ?. legendStyle ?. shadowColor ,
194
+ "textShadowBlur" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] ,
195
+ "textShadowOffsetX" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] ,
196
+ "textShadowOffsetY" : props ?. legendStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 2 ]
197
+ }
198
+ } ,
199
+ "series" : [
200
+ {
201
+ "name" : props . echartsConfig . type ,
202
+ "type" : props . echartsConfig . type ,
203
+ "left" : `${ props . left } %` ,
204
+ "top" : props . top ,
205
+ "bottom" : props . bottom ,
206
+ "width" : `${ props . left } %` ,
207
+ "min" : props . min ,
208
+ "max" : props . max ,
209
+ "gap" : props . gap ,
210
+ "funnelAlign" : props . echartsFunnelAlignConfig . funnelAlign ,
211
+ "sort" : props . echartsSortingConfig . sort ,
212
+ "itemStyle" : {
213
+ "opacity" : props . opacity ,
214
+ "borderColor" : props ?. chartStyle ?. chartBorderColor || theme ?. chartStyle ?. borderColor ,
215
+ "borderWidth" : props ?. chartStyle ?. chartBorderWidth || theme ?. chartStyle ?. borderWidth ,
216
+ "borderType" : props ?. chartStyle ?. chartBorderStyle || theme ?. chartStyle ?. borderType ,
217
+ "borderRadius" : props ?. chartStyle ?. chartBorderRadius || theme ?. chartStyle ?. borderRadius ,
218
+ "shadowColor" : props ?. chartStyle ?. chartShadowColor || theme ?. chartStyle ?. shadowColor ,
219
+ "shadowBlur" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. chartStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] ,
220
+ "shadowOffsetX" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. chartStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] ,
221
+ "shadowOffsetY" : props ?. chartStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. chartStyle ?. boxShadow ?. split ( 'px' ) [ 2 ]
222
+ } ,
223
+ "label" : {
224
+ "show" : props . label ,
225
+ "position" : props . echartsLabelConfig . top ,
226
+ "fontFamily" : props ?. labelStyle ?. chartFontFamily || theme ?. labelStyle ?. fontFamily ,
227
+ "fontSize" : props ?. labelStyle ?. chartTextSize || theme ?. labelStyle ?. fontSize ,
228
+ "fontWeight" : props ?. labelStyle ?. chartTextWeight || theme ?. labelStyle ?. fontWeight ,
229
+ "color" : props ?. labelStyle ?. chartTextColor || theme ?. labelStyle ?. fontColor || "#000000" ,
230
+ "fontStyle" : props ?. labelStyle ?. chartFontStyle || theme ?. labelStyle ?. fontStyle ,
231
+ "textShadowColor" : props ?. labelStyle ?. chartShadowColor || theme ?. labelStyle ?. shadowColor ,
232
+ "textShadowBlur" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 0 ] || theme ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] ,
233
+ "textShadowOffsetX" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 1 ] || theme ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] ,
234
+ "textShadowOffsetY" : props ?. labelStyle ?. chartBoxShadow ?. split ( 'px' ) [ 2 ] || theme ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 2 ]
235
+ } ,
236
+ "data" : props . echartsOption . data
237
+ }
238
+ ]
237
239
}
238
- ]
239
- }
240
240
return props . echartsOption ? opt : { } ;
241
241
242
242
}
0 commit comments