@@ -33,6 +33,10 @@ interface StackChartProps {
3333 } ;
3434}
3535
36+ const generateSbomBarName = ( sbom : StackChartProps , index : number ) => {
37+ return `${ Math . abs ( index - 10 ) } . ${ sbom . sbom_name } ` ;
38+ } ;
39+
3640export const SbomStackChartRenderer = ( htmlElement : HTMLElement , props : StackChartProps [ ] ) => {
3741 const showTickValues = props . every ( ( item ) => {
3842 return (
@@ -95,7 +99,9 @@ export const SbomStackChartRenderer = (htmlElement: HTMLElement, props: StackCha
9599 events = { {
96100 onClick : ( event ) => {
97101 const sbom_name = ( event . target as any ) . innerHTML as string | null ;
98- const sbom = props . find ( ( item ) => item . sbom_name === sbom_name ) ;
102+ const sbom = props . find (
103+ ( item , index ) => generateSbomBarName ( item , index ) === sbom_name ,
104+ ) ;
99105 if ( sbom ) {
100106 const sbomDetailsPage = `/sbom/content/${ sbom . sbom_id } ` ;
101107
@@ -132,12 +138,12 @@ export const SbomStackChartRenderer = (htmlElement: HTMLElement, props: StackCha
132138 < ChartBar
133139 key = { legend . name }
134140 labelComponent = { < ChartTooltip constrainToVisibleArea /> }
135- data = { props . map ( ( sbom ) => {
141+ data = { props . map ( ( sbom , index ) => {
136142 const severityKey = legend . severity ;
137143 const count = sbom . vulnerabilities [ severityKey ] as number ;
138144 return {
139145 name : legend . name ,
140- x : sbom . sbom_name ,
146+ x : generateSbomBarName ( sbom , index ) ,
141147 y : count ,
142148 label : `${ legend . name } : ${ count } ` ,
143149 } ;
0 commit comments