66* LICENSE file in the root directory of this source tree.
77*/
88
9-
109'use strict' ;
1110
12- var createGeo = require ( './geo' ) ;
1311var getSubplotCalcData = require ( '../../plots/get_data' ) . getSubplotCalcData ;
1412var counterRegex = require ( '../../lib' ) . counterRegex ;
1513
16- var GEO = 'geo' ;
17-
18- exports . name = GEO ;
19-
20- exports . attr = GEO ;
21-
22- exports . idRoot = GEO ;
23-
24- exports . idRegex = exports . attrRegex = counterRegex ( GEO ) ;
25-
26- exports . attributes = require ( './attributes' ) ;
27-
28- exports . layoutAttributes = require ( './layout_attributes' ) ;
14+ var createGeo = require ( './geo' ) ;
2915
30- exports . supplyLayoutDefaults = require ( './defaults' ) ;
16+ var GEO = 'geo' ;
17+ var counter = counterRegex ( GEO ) ;
18+
19+ var attributes = { } ;
20+ attributes [ GEO ] = {
21+ valType : 'subplotid' ,
22+ role : 'info' ,
23+ dflt : GEO ,
24+ editType : 'calc' ,
25+ description : [
26+ 'Sets a reference between this trace\'s geospatial coordinates and' ,
27+ 'a geographic map.' ,
28+ 'If *geo* (the default value), the geospatial coordinates refer to' ,
29+ '`layout.geo`.' ,
30+ 'If *geo2*, the geospatial coordinates refer to `layout.geo2`,' ,
31+ 'and so on.'
32+ ] . join ( ' ' )
33+ } ;
3134
32- exports . plot = function plotGeo ( gd ) {
35+ function plotGeo ( gd ) {
3336 var fullLayout = gd . _fullLayout ;
3437 var calcData = gd . calcdata ;
3538 var geoIds = fullLayout . _subplots [ GEO ] ;
@@ -62,9 +65,9 @@ exports.plot = function plotGeo(gd) {
6265
6366 geo . plot ( geoCalcData , fullLayout , gd . _promises ) ;
6467 }
65- } ;
68+ }
6669
67- exports . clean = function ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
70+ function clean ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
6871 var oldGeoKeys = oldFullLayout . _subplots [ GEO ] || [ ] ;
6972
7073 for ( var i = 0 ; i < oldGeoKeys . length ; i ++ ) {
@@ -76,9 +79,9 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
7679 oldGeo . clipDef . remove ( ) ;
7780 }
7881 }
79- } ;
82+ }
8083
81- exports . updateFx = function ( gd ) {
84+ function updateFx ( gd ) {
8285 var fullLayout = gd . _fullLayout ;
8386 var subplotIds = fullLayout . _subplots [ GEO ] ;
8487
@@ -87,4 +90,18 @@ exports.updateFx = function(gd) {
8790 var subplotObj = subplotLayout . _subplot ;
8891 subplotObj . updateFx ( fullLayout , subplotLayout ) ;
8992 }
93+ }
94+
95+ module . exports = {
96+ attr : GEO ,
97+ name : GEO ,
98+ idRoot : GEO ,
99+ idRegex : counter ,
100+ attrRegex : counter ,
101+ attributes : attributes ,
102+ layoutAttributes : require ( './layout_attributes' ) ,
103+ supplyLayoutDefaults : require ( './layout_defaults' ) ,
104+ plot : plotGeo ,
105+ updateFx : updateFx ,
106+ clean : clean
90107} ;
0 commit comments