File tree Expand file tree Collapse file tree
src/public/viz-guardrails Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -945,7 +945,11 @@ export function LineChart({
945945 if ( selection ) {
946946 labels = labels . concat (
947947 selection . map ( ( country ) => {
948- const label = country ;
948+ let label = country ;
949+ if ( guardrail === 'metadata' && dataname === 'clean_data' ) {
950+ const item = items . find ( ( it ) => it . name === country ) ;
951+ if ( item ?. subregion ) label = `${ country } (${ item . subregion } )` ;
952+ }
949953 return {
950954 label,
951955 y : data . filter ( ( val ) => val [ parameters . cat_var ] === country ) . slice ( - 1 ) . map ( ( val ) => yScale ( val [ parameters . y_var ] ) ) [ 0 ] ,
@@ -1050,10 +1054,13 @@ export function LineChart({
10501054 . filter ( ( line ) => line !== null )
10511055 . map ( ( line ) => {
10521056 if ( ! line ) return null ;
1053- const item = items . find ( ( it ) => it . name === line . name ) ;
1054- const subregion = item ?. subregion ? ` (${ item . subregion } )` : '' ;
1057+ let label = line . name ;
1058+ if ( dataname === 'clean_data' ) {
1059+ const item = items . find ( ( it ) => it . name === line . name ) ;
1060+ if ( item ?. subregion ) label = `${ line . name } (${ item . subregion } )` ;
1061+ }
10551062 return {
1056- label : ` ${ line . name } ${ subregion } ` ,
1063+ label,
10571064 y : yScale ( line . lastPoint [ 1 ] ) ,
10581065 color : darkGrayColor ,
10591066 } ;
You can’t perform that action at this time.
0 commit comments