@@ -107,7 +107,7 @@ export function getSeriesConfig(props: EchartsConfigProps) {
107
107
encodeY = props . xAxisKey ;
108
108
}
109
109
return {
110
- name : props . chartConfig . subtype === "waterfall" && index === 0 ?s . getView ( ) . seriesName + "_placeholder " :s . getView ( ) . seriesName ,
110
+ name : props . chartConfig . subtype === "waterfall" && index === 0 ?" " :s . getView ( ) . seriesName ,
111
111
selectedMode : "single" ,
112
112
select : {
113
113
itemStyle : {
@@ -212,8 +212,8 @@ export function getEchartsConfig(
212
212
} , 0 )
213
213
const total = sum ;
214
214
transformedData . map ( d => {
215
- d [ `${ seriesColumnNames [ 0 ] } _placeholder ` ] = sum - d [ seriesColumnNames [ 0 ] ] ;
216
- sum = d [ `${ seriesColumnNames [ 0 ] } _placeholder ` ] ;
215
+ d [ ` ` ] = sum - d [ seriesColumnNames [ 0 ] ] ;
216
+ sum = d [ ` ` ] ;
217
217
} )
218
218
transformedData = [ { [ seriesColumnNames [ 0 ] + "_placeholder" ] : 0 , [ seriesColumnNames [ 0 ] ] : total } , ...transformedData ]
219
219
}
@@ -225,11 +225,14 @@ export function getEchartsConfig(
225
225
radius : [ props . chartConfig . polarData . polarRadiusDeg , `${ props . chartConfig . polarData . polarRadiusSize } %` ] ,
226
226
} ,
227
227
radiusAxis : {
228
- max : props . chartConfig . polarData . radiusAxisMax ,
228
+ type : props . chartConfig . polarData . polarIsTangent ?'category' :undefined ,
229
+ data : props . chartConfig . polarData . polarIsTangent ?props . chartConfig . polarData . labelData :undefined ,
230
+ max : props . chartConfig . polarData . polarIsTangent ?undefined :props . chartConfig . polarData . radiusAxisMax || undefined ,
229
231
} ,
230
232
angleAxis : {
231
- type : 'category' ,
232
- data : props . chartConfig . polarData . labelData ,
233
+ type : props . chartConfig . polarData . polarIsTangent ?undefined :'category' ,
234
+ data : props . chartConfig . polarData . polarIsTangent ?undefined :props . chartConfig . polarData . labelData ,
235
+ max : props . chartConfig . polarData . polarIsTangent ?props . chartConfig . polarData . radiusAxisMax || undefined :undefined ,
233
236
startAngle : 75
234
237
} ,
235
238
}
@@ -302,6 +305,24 @@ export function getEchartsConfig(
302
305
}
303
306
} ,
304
307
} ;
308
+
309
+ //Waterfall x-label initialization
310
+ if ( props . chartConfig ?. subtype === "waterfall" && props . xAxisData . length === 0 ) {
311
+ //default labels
312
+ config . xAxis . data = [ "Total" ] ;
313
+ for ( let i = 1 ; i < transformedData . length ; i ++ )
314
+ config . xAxis . data . push ( `Column${ i } ` ) ;
315
+ }
316
+
317
+ //Polar x-label initialization
318
+ if ( props . chartConfig ?. subtype === "polar" && props . chartConfig . polarData . labelData . length === 0 ) {
319
+ //default labels
320
+ let labelData = [ ] ;
321
+ for ( let i = 0 ; i < transformedData . length ; i ++ )
322
+ labelData . push ( `C${ i + 1 } ` ) ;
323
+ if ( props . chartConfig . polarData . polarIsTangent && config . radiusAxis . data . length === 0 ) config . radiusAxis . data = labelData ;
324
+ if ( ! props . chartConfig . polarData . polarIsTangent && config . angleAxis . data . length === 0 ) config . angleAxis . data = labelData ;
325
+ }
305
326
console . log ( "Config" , config ) ;
306
327
console . log ( "Props" , props ) ;
307
328
}
0 commit comments