@@ -71,19 +71,28 @@ export const shamefullyAdjustAxisRef = (graphDiv, payload) => {
71
71
}
72
72
} ;
73
73
74
- export const shamefullyAdjustGeo = ( { layout : { geo = { } } } , { update} ) => {
75
- if ( update [ 'geo.scope' ] ) {
76
- update [ 'geo.projection' ] = { } ;
77
- update [ 'geo.center' ] = { } ;
78
- }
79
- if (
80
- // requesting projection change
81
- update [ 'geo.projection.type' ] &&
82
- ( update [ 'geo.projection.type' ] === 'albers usa' || geo . scope === 'usa' )
83
- ) {
84
- update [ 'geo.scope' ] = { } ;
85
- update [ 'geo.center' ] = { } ;
86
- }
74
+ const geoRegex = / ^ ( g e o \d * ) \. / ;
75
+ export const shamefullyAdjustGeo = ( { layout} , { update} ) => {
76
+ Object . keys ( update ) . forEach ( k => {
77
+ const geoMatch = geoRegex . exec ( k ) ;
78
+ if ( geoMatch ) {
79
+ const geo = geoMatch [ 1 ] ;
80
+ if ( update [ geo + '.scope' ] ) {
81
+ update [ geo + '.projection' ] = { } ;
82
+ update [ geo + '.center' ] = { } ;
83
+ }
84
+
85
+ if (
86
+ // requesting projection change
87
+ update [ geo + '.projection.type' ] &&
88
+ ( update [ geo + '.projection.type' ] === 'albers usa' ||
89
+ ( layout [ geo ] && layout [ geo ] . scope === 'usa' ) )
90
+ ) {
91
+ update [ geo + '.scope' ] = { } ;
92
+ update [ geo + '.center' ] = { } ;
93
+ }
94
+ }
95
+ } ) ;
87
96
} ;
88
97
89
98
export const shamefullyAddTableColumns = ( graphDiv , { traceIndexes, update} ) => {
0 commit comments