File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
docs/demos/config/demo/Sankey Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ function Example() {
131
131
const timeoutRef = React . useRef < NodeJS . Timeout > ( ) ;
132
132
const intervalRef = React . useRef < NodeJS . Timeout | null > ( null ) ;
133
133
const [ tooltipStyles , setTooltipStyles ] = React . useState < React . CSSProperties > ( { } ) ;
134
+ const [ hideLabel , setHideLabel ] = React . useState ( false ) ;
134
135
135
136
const spec : SankeyProps = {
136
137
height : 600 ,
@@ -174,6 +175,8 @@ function Example() {
174
175
visible : true ,
175
176
offset : - 12 ,
176
177
formatMethod ( _ , datum ) {
178
+ if ( hideLabel )
179
+ return `` ;
177
180
return `${ datum ?. name } ${ datum ?. total ?. toLocaleString ( ) } ` ;
178
181
} ,
179
182
style : {
@@ -335,6 +338,16 @@ function Example() {
335
338
[ ] ,
336
339
) ;
337
340
341
+ React . useEffect ( ( ) => {
342
+ const timeout = setTimeout ( ( ) => {
343
+ setHideLabel ( true ) ;
344
+ } , 5 * 1000 ) ;
345
+
346
+ return ( ) => {
347
+ timeout && clearTimeout ( timeout ) ;
348
+ } ;
349
+ } , [ ] ) ;
350
+
338
351
const handleClick : SankeyProps [ 'onClick' ] = ( e ) => {
339
352
if ( e . node ?. type === 'rect' ) {
340
353
const { datum } = e ;
@@ -375,7 +388,6 @@ function Example() {
375
388
< >
376
389
< Sankey
377
390
{ ...spec }
378
- skipFunctionDiff
379
391
ref = { chartRef }
380
392
onClick = { handleClick }
381
393
onDblClick = { handleDblClick }
You can’t perform that action at this time.
0 commit comments