@@ -33,7 +33,7 @@ export interface LineChartPoint {
3333}
3434
3535export interface LineChartMultiSeries {
36- id ? : string
36+ id : string
3737 label : string
3838 color : string
3939 data : LineChartPoint [ ]
@@ -94,11 +94,10 @@ function LineChartComponent({
9494 const hasExternalWrapper = ! label || label === ''
9595
9696 const allSeries = useMemo (
97- ( ) =>
98- ( Array . isArray ( series ) && series . length > 0
99- ? [ { id : 'base' , label, color, data } , ...series ]
100- : [ { id : 'base' , label, color, data } ]
101- ) . map ( ( s , idx ) => ( { ...s , id : s . id || s . label || String ( idx ) } ) ) ,
97+ ( ) => [
98+ { id : 'base' , sourceId : 'base' , label, color, data } ,
99+ ...( series ?? [ ] ) . map ( ( item ) => ( { ...item , id : `series:${ item . id } ` , sourceId : item . id } ) ) ,
100+ ] ,
102101 [ series , label , color , data ]
103102 )
104103
@@ -292,6 +291,7 @@ function LineChartComponent({
292291 < ChartDataTable
293292 label = { label || 'Values by date' }
294293 series = { allSeries . map ( ( item ) => ( {
294+ id : item . id ,
295295 label : item . label || unit || 'Value' ,
296296 data : item . data ,
297297 } ) ) }
@@ -378,7 +378,7 @@ function LineChartComponent({
378378 const baseOpacity = isActive ? 1 : 0.12
379379 const strokeOpacity = hoverSeriesId ? ( isHovered ? 1 : 0.2 ) : baseOpacity
380380 const sw = ( ( ) => {
381- switch ( ( s . id || '' ) . toLowerCase ( ) ) {
381+ switch ( s . sourceId . toLowerCase ( ) ) {
382382 case 'p50' :
383383 return isDark ? 1.5 : 1.7
384384 case 'p90' :
@@ -539,7 +539,7 @@ function LineChartComponent({
539539 const seriesIndex = allSeries . findIndex ( ( x ) => x . id === s . id )
540540 const v = allSeries [ seriesIndex ] ?. data ?. [ hoverIndex ] ?. value
541541 const valueStr = fmt ( v )
542- const labelStr = s . label || String ( s . id || '' )
542+ const labelStr = s . label || s . sourceId
543543 const len = `${ labelStr } ${ valueStr } ` . length
544544 return Math . max ( m , len )
545545 } , 0 )
@@ -557,7 +557,7 @@ function LineChartComponent({
557557 { toDisplay . map ( ( s ) => {
558558 const seriesIndex = allSeries . findIndex ( ( x ) => x . id === s . id )
559559 const val = allSeries [ seriesIndex ] ?. data ?. [ hoverIndex ] ?. value
560- const seriesLabel = s . label || s . id
560+ const seriesLabel = s . label || s . sourceId
561561 const showLabel =
562562 seriesLabel && seriesLabel !== 'base' && seriesLabel . trim ( ) !== ''
563563 return (
0 commit comments