@@ -257,6 +257,7 @@ <h2>World map</h2>
257257 < div class ="toolbar " id ="winner-aspect-toolbar "> </ div >
258258 </ div >
259259 < p class ="muted " id ="map-mode-note "> Colors show which model family wins in each country for the selected evaluation aspect.</ p >
260+ < p class ="muted " id ="map-coverage-note "> </ p >
260261 < div class ="world-map-wrap " id ="winner-map-wrap "> < p class ="muted "> Loading map…</ p > </ div >
261262 < div class ="winner-legend " id ="winner-legend "> </ div >
262263 < div class ="benefit-legend " id ="benefit-legend " style ="display:none; ">
@@ -290,6 +291,24 @@ <h2>World map</h2>
290291 const benefitLegend = document . getElementById ( "benefit-legend" ) ;
291292 const benefitLegendLabel = document . getElementById ( "benefit-legend-label" ) ;
292293 const winnerSummary = document . getElementById ( "winner-summary" ) ;
294+ const mapCoverageNote = document . getElementById ( "map-coverage-note" ) ;
295+
296+ const MAP_FILL_OUTSIDE = "#e8eaed" ;
297+ const MAP_FILL_NO_DATA = "#f5f5f5" ;
298+ const benchmarkIsos = new Set ( DATA . benchmark_map_isos || [ ] ) ;
299+ if ( mapCoverageNote ) {
300+ mapCoverageNote . textContent = DATA . map_coverage_note || (
301+ "Only CY-Bench countries are colored; other land is neutral gray."
302+ ) ;
303+ }
304+
305+ function isBenchmarkIso ( iso ) {
306+ return benchmarkIsos . has ( iso ) ;
307+ }
308+
309+ function mapBaseFill ( iso ) {
310+ return isBenchmarkIso ( iso ) ? MAP_FILL_NO_DATA : MAP_FILL_OUTSIDE ;
311+ }
293312
294313 let radarMode = "relative" ;
295314 let mapMode = "winner" ;
@@ -759,19 +778,25 @@ <h2>World map</h2>
759778 . attr ( "class" , "country" )
760779 . attr ( "d" , mapPath )
761780 . attr ( "fill" , d => {
762- const rec = winners . get ( d . properties . ISO_A2 ) ;
763- if ( ! rec ) return "#f0f0f0" ;
781+ const iso = d . properties . ISO_A2 ;
782+ if ( ! isBenchmarkIso ( iso ) ) return MAP_FILL_OUTSIDE ;
783+ const rec = winners . get ( iso ) ;
784+ if ( ! rec ) return MAP_FILL_NO_DATA ;
764785 return colors [ rec . winner_family ] || "#999" ;
765786 } )
766- . attr ( "stroke" , null )
767- . attr ( "stroke-width" , null ) ;
787+ . attr ( "stroke" , d => isBenchmarkIso ( d . properties . ISO_A2 ) ? "#fff" : "#d0d7de" )
788+ . attr ( "stroke-width" , d => isBenchmarkIso ( d . properties . ISO_A2 ) ? 0.5 : 0.25 ) ;
768789
769790 countriesSel . selectAll ( "title" )
770791 . data ( d => [ d ] )
771792 . join ( "title" )
772793 . text ( d => {
773- const rec = winners . get ( d . properties . ISO_A2 ) ;
774- if ( ! rec ) return `${ d . properties . NAME || d . properties . ISO_A2 } : no data` ;
794+ const iso = d . properties . ISO_A2 ;
795+ if ( ! isBenchmarkIso ( iso ) ) {
796+ return `${ d . properties . NAME || iso } : not in CY-Bench` ;
797+ }
798+ const rec = winners . get ( iso ) ;
799+ if ( ! rec ) return `${ d . properties . NAME || iso } : no data for this horizon/crop` ;
775800 return `${ rec . country } : ${ rec . winner_family } (${ rec . winner_model } ), ${ byAspect . metric } =${ rec . value . toFixed ( 3 ) } ` ;
776801 } ) ;
777802
@@ -800,26 +825,36 @@ <h2>World map</h2>
800825 . attr ( "class" , "country" )
801826 . attr ( "d" , mapPath )
802827 . attr ( "fill" , d => {
803- const rec = byCountry . get ( d . properties . ISO_A2 ) ;
804- if ( ! rec || rec . benefit_pct == null ) return "#f0f0f0" ;
828+ const iso = d . properties . ISO_A2 ;
829+ if ( ! isBenchmarkIso ( iso ) ) return MAP_FILL_OUTSIDE ;
830+ const rec = byCountry . get ( iso ) ;
831+ if ( ! rec || rec . benefit_pct == null ) return MAP_FILL_NO_DATA ;
805832 return benefitColor ( rec . benefit_pct , extent ) ;
806833 } )
807834 . attr ( "stroke" , d => {
808- const rec = byCountry . get ( d . properties . ISO_A2 ) ;
809- if ( ! rec || ! benefitOffScale ( rec . benefit_pct , extent ) ) return null ;
810- return "#1f2328" ;
835+ const iso = d . properties . ISO_A2 ;
836+ if ( ! isBenchmarkIso ( iso ) ) return "#d0d7de" ;
837+ const rec = byCountry . get ( iso ) ;
838+ if ( rec && benefitOffScale ( rec . benefit_pct , extent ) ) return "#1f2328" ;
839+ return "#fff" ;
811840 } )
812841 . attr ( "stroke-width" , d => {
813- const rec = byCountry . get ( d . properties . ISO_A2 ) ;
814- return rec && benefitOffScale ( rec . benefit_pct , extent ) ? 1.1 : null ;
842+ const iso = d . properties . ISO_A2 ;
843+ if ( ! isBenchmarkIso ( iso ) ) return 0.25 ;
844+ const rec = byCountry . get ( iso ) ;
845+ return rec && benefitOffScale ( rec . benefit_pct , extent ) ? 1.1 : 0.5 ;
815846 } ) ;
816847
817848 countriesSel . selectAll ( "title" )
818849 . data ( d => [ d ] )
819850 . join ( "title" )
820851 . text ( d => {
821- const rec = byCountry . get ( d . properties . ISO_A2 ) ;
822- if ( ! rec ) return `${ d . properties . NAME || d . properties . ISO_A2 } : no data` ;
852+ const iso = d . properties . ISO_A2 ;
853+ if ( ! isBenchmarkIso ( iso ) ) {
854+ return `${ d . properties . NAME || iso } : not in CY-Bench` ;
855+ }
856+ const rec = byCountry . get ( iso ) ;
857+ if ( ! rec ) return `${ d . properties . NAME || iso } : no data for this horizon/crop` ;
823858 const offScale = benefitOffScale ( rec . benefit_pct , extent )
824859 ? ` (color saturated; scale ±${ extent } %)`
825860 : "" ;
0 commit comments