6
6
* LICENSE file in the root directory of this source tree.
7
7
*/
8
8
9
-
10
9
'use strict' ;
11
10
12
- var createGeo = require ( './geo' ) ;
13
11
var getSubplotCalcData = require ( '../../plots/get_data' ) . getSubplotCalcData ;
14
12
var counterRegex = require ( '../../lib' ) . counterRegex ;
15
13
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' ) ;
29
15
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
+ } ;
31
34
32
- exports . plot = function plotGeo ( gd ) {
35
+ function plotGeo ( gd ) {
33
36
var fullLayout = gd . _fullLayout ;
34
37
var calcData = gd . calcdata ;
35
38
var geoIds = fullLayout . _subplots [ GEO ] ;
@@ -62,9 +65,9 @@ exports.plot = function plotGeo(gd) {
62
65
63
66
geo . plot ( geoCalcData , fullLayout , gd . _promises ) ;
64
67
}
65
- } ;
68
+ }
66
69
67
- exports . clean = function ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
70
+ function clean ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
68
71
var oldGeoKeys = oldFullLayout . _subplots [ GEO ] || [ ] ;
69
72
70
73
for ( var i = 0 ; i < oldGeoKeys . length ; i ++ ) {
@@ -76,9 +79,9 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
76
79
oldGeo . clipDef . remove ( ) ;
77
80
}
78
81
}
79
- } ;
82
+ }
80
83
81
- exports . updateFx = function ( gd ) {
84
+ function updateFx ( gd ) {
82
85
var fullLayout = gd . _fullLayout ;
83
86
var subplotIds = fullLayout . _subplots [ GEO ] ;
84
87
@@ -87,4 +90,18 @@ exports.updateFx = function(gd) {
87
90
var subplotObj = subplotLayout . _subplot ;
88
91
subplotObj . updateFx ( fullLayout , subplotLayout ) ;
89
92
}
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
90
107
} ;
0 commit comments