@@ -134,36 +134,40 @@ export function getEchartsConfig(
134
134
chartSize ?: ChartSize ,
135
135
theme ?: any ,
136
136
) : EChartsOptionWithMap {
137
+
138
+ console . log ( "props" , props ) ;
139
+ console . log ( "theme" , theme ) ;
140
+
137
141
if ( props . mode === "json" ) {
138
142
let opt = {
139
143
"title" : {
140
144
"text" : props . echartsTitle ,
141
145
'top' : props . echartsLegendConfig . top === 'bottom' ?'top' :'bottom' ,
142
146
"left" :props . echartsTitleConfig . top ,
143
147
"textStyle" : {
144
- "fontFamily" : props ?. titleStyle ?. fontFamily ,
145
- "fontSize" : props ?. titleStyle ?. textSize ,
146
- "fontWeight" : props ?. titleStyle ?. textWeight ,
147
- "color" : props ?. titleStyle ?. text ,
148
- "fontStyle" : props ?. titleStyle ?. fontStyle ,
149
- "textShadowColor" : props ?. titleStyle ?. boxShadowColor ,
150
- "textShadowBlur" : props ?. titleStyle ?. boxShadow ?. split ( ' ' ) [ 0 ] ,
151
- "textShadowOffsetX" : props ?. titleStyle ?. boxShadow ?. split ( ' ' ) [ 1 ] ,
152
- "textShadowOffsetY" : props ?. titleStyle ?. boxShadow ?. split ( ' ' ) [ 2 ]
148
+ "fontFamily" : props ?. titleStyle ?. fontFamily || theme ?. titleStyle ?. fontFamily ,
149
+ "fontSize" : props ?. titleStyle ?. textSize || theme ?. titleStyle ?. fontSize ,
150
+ "fontWeight" : props ?. titleStyle ?. textWeight || theme ?. titleStyle ?. fontWeight ,
151
+ "color" : props ?. titleStyle ?. text || theme ?. titleStyle ?. fontColor ,
152
+ "fontStyle" : props ?. titleStyle ?. fontStyle || theme ?. titleStyle ?. fontStyle ,
153
+ "textShadowColor" : props ?. titleStyle ?. boxShadowColor || theme ?. titleStyle ?. shadowColor ,
154
+ "textShadowBlur" : props ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] || theme ?. titleStyle ?. boxShadow . split ( 'px ') [ 0 ] ,
155
+ "textShadowOffsetX" : props ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] || theme ?. titleStyle ?. boxShadow . split ( 'px ') [ 1 ] ,
156
+ "textShadowOffsetY" : props ?. titleStyle ?. boxShadow ?. split ( 'px' ) [ 2 ] || theme ?. titleStyle ?. boxShadow . split ( 'px ') [ 2 ]
153
157
}
154
158
} ,
155
- "backgroundColor" : props ?. chartStyle ?. gradientBackground && props ?. chartStyle ?. background
156
- ? {
157
- "x" : props ?. chartStyle ?. direction ?. split ( ' ' ) [ 0 ] ,
158
- "y" : props ?. chartStyle ?. direction ?. split ( ' ' ) [ 1 ] ,
159
- "x2" : props ?. chartStyle ?. direction ?. split ( ' ' ) [ 2 ] ,
160
- "y2" : props ?. chartStyle ?. direction ?. split ( ' ' ) [ 3 ] ,
161
- "colorStops" : [
162
- { "offset" : 0 , "color" : props ?. chartStyle ?. opacity ? props ?. chartStyle ?. background + opacityToHex ( props ?. chartStyle ?. opacity ) : props ?. chartStyle ?. background } ,
163
- { "offset" : 1 , "color" : props ?. chartStyle ?. opacity ? props ?. chartStyle ?. gradientBackground + opacityToHex ( props ?. chartStyle ?. opacity ) : props ?. chartStyle ?. gradientBackground }
164
- ]
165
- }
166
- : props ?. chartStyle ?. opacity ? ( props ?. chartStyle ?. background ) + opacityToHex ( props ?. chartStyle ?. opacity ) : props ?. chartStyle ?. background ,
159
+ "backgroundColor" : props ?. chartStyle ?. background || theme ?. chartStyle ?. backgroundColor ,
160
+ // ? {
161
+ // "x": props?.chartStyle?.direction?.split(' ')[0],
162
+ // "y": props?.chartStyle?.direction?.split(' ')[1],
163
+ // "x2": props?.chartStyle?.direction?.split(' ')[2],
164
+ // "y2": props?.chartStyle?.direction?.split(' ')[3],
165
+ // "colorStops": [
166
+ // { "offset": 0, "color": props?.chartStyle?.opacity ? props?.chartStyle?.background + opacityToHex(props?.chartStyle?.opacity) : props?.chartStyle?.background},
167
+ // { "offset": 1, "color": props?.chartStyle?.opacity ? props?.chartStyle?.gradientBackground + opacityToHex(props?.chartStyle?.opacity) : props?.chartStyle?.gradientBackground}
168
+ // ]
169
+ // }
170
+ // : props?.chartStyle?.opacity ? (props?.chartStyle?.background) + opacityToHex(props?.chartStyle?.opacity) : props?.chartStyle?.background,
167
171
"color" : props . echartsOption . data ?. map ( data => data . color ) ,
168
172
"tooltip" : props . tooltip && {
169
173
"trigger" : "item" ,
@@ -173,15 +177,15 @@ export function getEchartsConfig(
173
177
"data" : props . echartsOption . data ?. map ( data => data . name ) ,
174
178
"top" : props . echartsLegendConfig . top ,
175
179
"textStyle" : {
176
- "fontFamily" : props ?. legendStyle ?. fontFamily ,
177
- "fontSize" : props ?. legendStyle ?. textSize ,
178
- "fontWeight" : props ?. legendStyle ?. textWeight ,
179
- "color" : props ?. legendStyle ?. text ,
180
- "fontStyle" : props ?. legendStyle ?. fontStyle ,
181
- "textShadowColor" : props ?. legendStyle ?. boxShadowColor ,
182
- "textShadowBlur" : props ?. legendStyle ?. boxShadow ?. split ( ' ' ) [ 0 ] ,
183
- "textShadowOffsetX" : props ?. legendStyle ?. boxShadow ?. split ( ' ' ) [ 1 ] ,
184
- "textShadowOffsetY" : props ?. legendStyle ?. boxShadow ?. split ( ' ' ) [ 2 ]
180
+ "fontFamily" : props ?. legendStyle ?. fontFamily || theme ?. legendStyle ?. fontFamily ,
181
+ "fontSize" : props ?. legendStyle ?. textSize || theme ?. legendStyle ?. fontSize ,
182
+ "fontWeight" : props ?. legendStyle ?. textWeight || theme ?. legendStyle ?. fontWeight ,
183
+ "color" : props ?. legendStyle ?. text || theme ?. legendStyle ?. fontColor ,
184
+ "fontStyle" : props ?. legendStyle ?. fontStyle || theme ?. legendStyle ?. fontStyle ,
185
+ "textShadowColor" : props ?. legendStyle ?. boxShadowColor || theme ?. legendStyle ?. shadowColor ,
186
+ "textShadowBlur" : props ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] || theme ?. legendStyle ?. boxShadow . split ( 'px ') [ 0 ] ,
187
+ "textShadowOffsetX" : props ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] || theme ?. legendStyle ?. boxShadow . split ( 'px ') [ 1 ] ,
188
+ "textShadowOffsetY" : props ?. legendStyle ?. boxShadow ?. split ( 'px' ) [ 2 ] || theme ?. legendStyle ?. boxShadow . split ( 'px ') [ 2 ]
185
189
}
186
190
} ,
187
191
"series" : [
@@ -199,27 +203,27 @@ export function getEchartsConfig(
199
203
"sort" : props . echartsSortingConfig . sort ,
200
204
"itemStyle" : {
201
205
"opacity" : props . opacity ,
202
- "borderColor" : props ?. chartStyle ?. border ,
203
- "borderWidth" : props ?. chartStyle ?. borderWidth ,
204
- "borderType" : props ?. chartStyle ?. borderStyle ,
205
- "borderRadius" : props ?. chartStyle ?. radius ,
206
- "shadowColor" : props ?. chartStyle ?. boxShadowColor ,
207
- "shadowBlur" : props ?. chartStyle ?. boxShadow ?. split ( ' ' ) [ 0 ] ,
208
- "shadowOffsetX" : props ?. chartStyle ?. boxShadow ?. split ( ' ' ) [ 0 ] ,
209
- "shadowOffsetY" : props ?. chartStyle ?. boxShadow ?. split ( ' ' ) [ 0 ]
206
+ "borderColor" : props ?. chartStyle ?. border || theme ?. chartStyle ?. borderColor ,
207
+ "borderWidth" : props ?. chartStyle ?. borderWidth || theme ?. chartStyle ?. borderWidth ,
208
+ "borderType" : props ?. chartStyle ?. borderStyle || theme ?. chartStyle ?. borderType ,
209
+ "borderRadius" : props ?. chartStyle ?. radius || theme ?. chartStyle ?. borderRadius ,
210
+ "shadowColor" : props ?. chartStyle ?. boxShadowColor || theme ?. chartStyle ?. shadowColor ,
211
+ "shadowBlur" : props ?. chartStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px ') [ 0 ] ,
212
+ "shadowOffsetX" : props ?. chartStyle ?. boxShadow ?. split ( 'px ' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px' ) [ 1 ] ,
213
+ "shadowOffsetY" : props ?. chartStyle ?. boxShadow ?. split ( 'px ' ) [ 0 ] || theme ?. chartStyle ?. boxShadow . split ( 'px' ) [ 2 ]
210
214
} ,
211
215
"label" : {
212
216
"show" : props . label ,
213
217
"position" : props . echartsLabelConfig . top ,
214
- "fontFamily" : props ?. labelStyle ?. fontFamily ,
215
- "fontSize" : props ?. labelStyle ?. textSize ,
216
- "fontWeight" : props ?. labelStyle ?. textWeight ,
217
- "color" : props ?. labelStyle ?. text ,
218
- "fontStyle" : props ?. labelStyle ?. fontStyle ,
219
- "textShadowColor" : props ?. labelStyle ?. boxShadowColor ,
220
- "textShadowBlur" : props ?. labelStyle ?. boxShadow ?. split ( ' ' ) [ 0 ] ,
221
- "textShadowOffsetX" : props ?. labelStyle ?. boxShadow ?. split ( ' ' ) [ 1 ] ,
222
- "textShadowOffsetY" : props ?. labelStyle ?. boxShadow ?. split ( ' ' ) [ 2 ]
218
+ "fontFamily" : props ?. labelStyle ?. fontFamily || theme ?. labelStyle ?. fontFamily ,
219
+ "fontSize" : props ?. labelStyle ?. textSize || theme ?. labelStyle ?. fontSize ,
220
+ "fontWeight" : props ?. labelStyle ?. textWeight || theme ?. labelStyle ?. fontWeight ,
221
+ "color" : props ?. labelStyle ?. text || theme ?. labelStyle ?. fontColor ,
222
+ "fontStyle" : props ?. labelStyle ?. fontStyle || theme ?. labelStyle ?. fontStyle ,
223
+ "textShadowColor" : props ?. labelStyle ?. boxShadowColor || theme ?. labelStyle ?. shadowColor ,
224
+ "textShadowBlur" : props ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 0 ] || theme ?. labelStyle ?. boxShadow . split ( 'px ') [ 0 ] ,
225
+ "textShadowOffsetX" : props ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 1 ] || theme ?. labelStyle ?. boxShadow . split ( 'px ') [ 1 ] ,
226
+ "textShadowOffsetY" : props ?. labelStyle ?. boxShadow ?. split ( 'px' ) [ 2 ] || theme ?. labelStyle ?. boxShadow . split ( 'px ') [ 2 ]
223
227
} ,
224
228
"data" : props . echartsOption . data
225
229
}
0 commit comments