File tree 2 files changed +18
-3
lines changed
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -473,7 +473,7 @@ export class BaseChart {
473
473
if ( this . getLegendType ( ) === Configuration . legend . basedOn . LABELS && d . value === Configuration . legend . items . status . ACTIVE ) {
474
474
return this . colorScale [ this . displayData . datasets [ 0 ] . label ] ( d . key ) ;
475
475
} else if ( d . value === Configuration . legend . items . status . ACTIVE ) {
476
- return this . colorScale [ d . key ] ( ) ;
476
+ return this . colorScale [ d . key ] ( ) ;
477
477
}
478
478
479
479
return "white" ;
@@ -520,6 +520,7 @@ export class BaseChart {
520
520
521
521
addOrUpdateLegend ( ) {
522
522
this . addLegend ( ) ;
523
+
523
524
if ( this . options . legendClickable ) {
524
525
this . setClickableLegend ( ) ;
525
526
}
Original file line number Diff line number Diff line change @@ -342,16 +342,30 @@ export class PieChart extends BaseChart {
342
342
this . container . select ( ".legend" )
343
343
. selectAll ( "*" ) . remove ( ) ;
344
344
345
+ const legendItems = this . getLegendItems ( ) ;
345
346
const legend = this . container . select ( ".legend" )
346
347
. attr ( "font-size" , Configuration . legend . fontSize )
347
348
. selectAll ( "div" )
348
- . data ( this . getLegendItemKeys ( ) )
349
+ . data ( Object . keys ( legendItems ) )
349
350
. enter ( ) . append ( "li" )
350
351
. attr ( "class" , "legend-btn active" ) ;
351
352
352
353
legend . append ( "div" )
353
354
. attr ( "class" , "legend-circle" )
354
- . style ( "background-color" , ( d , i ) => this . colorScale ( d ) ) ;
355
+ . style ( "background-color" , ( d , i ) => {
356
+ if ( legendItems [ d ] === Configuration . legend . items . status . ACTIVE ) {
357
+ return this . colorScale ( d ) ;
358
+ }
359
+
360
+ return "white" ;
361
+ } )
362
+ . style ( "border" , ( d , i ) => {
363
+ if ( legendItems [ d ] === Configuration . legend . items . status . ACTIVE ) {
364
+ return "none" ;
365
+ }
366
+
367
+ return `2px solid ${ this . colorScale ( d ) } ` ;
368
+ } ) ;
355
369
356
370
legend . append ( "text" )
357
371
. text ( d => d ) ;
You can’t perform that action at this time.
0 commit comments