@@ -103,7 +103,10 @@ function styleOfMarker(group: Group): BaseStyleProps {
103103}
104104
105105export class CategoryItem extends Component < CategoryItemStyleProps > {
106- constructor ( options : CategoryItemOptions ) {
106+ // Key fields, used to pass extra info like id, index for poptip rendering
107+ public keyFields : object = { } ;
108+
109+ constructor ( options : CategoryItemOptions , keyFields ?: Omit < CategoryItemOptions , 'style' > ) {
107110 super ( options , {
108111 span : [ 1 , 1 ] ,
109112 marker : ( ) => new Circle ( { style : { r : 6 } } ) ,
@@ -115,6 +118,7 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
115118 labelTextBaseline : 'middle' ,
116119 valueTextBaseline : 'middle' ,
117120 } ) ;
121+ this . keyFields = keyFields || { } ;
118122 }
119123
120124 private poptipGroup ! : Poptip ;
@@ -313,7 +317,7 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
313317 const label = typeof labelText === 'string' ? labelText : ( labelText as DisplayObject ) ?. attr ( 'text' ) ;
314318 const value = typeof valueText === 'string' ? valueText : ( valueText as DisplayObject ) ?. attr ( 'text' ) ;
315319 if ( typeof poptip . render === 'function' ) {
316- return { html : poptip . render ( { label, value, color : markerFill as string } ) } ;
320+ return { html : poptip . render ( { ... this . keyFields , label, value, color : markerFill as string } ) } ;
317321 }
318322 let html = '' ;
319323 if ( typeof label === 'string' || typeof label === 'number' ) {
0 commit comments