Skip to content

Commit 3a0c621

Browse files
committed
scattergeo: refactor plot !!
- add support for 'connectgaps' - add support for 'fill: 'toself' - remove all traces of hover / click handlers
1 parent 78d9afa commit 3a0c621

File tree

6 files changed

+125
-244
lines changed

6 files changed

+125
-244
lines changed

src/traces/scatter/fillcolor_defaults.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
var Color = require('../../components/color');
1313

1414

15-
// common to 'scatter' and 'scattergl'
1615
module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce) {
1716
var inheritColorFromMarker = false;
1817

src/traces/scattergeo/attributes.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
valType: 'data_array',
2828
description: 'Sets the latitude coordinates (in degrees North).'
2929
},
30+
3031
locations: {
3132
valType: 'data_array',
3233
description: [
@@ -45,7 +46,9 @@ module.exports = {
4546
'to regions on the map.'
4647
].join(' ')
4748
},
49+
4850
mode: extendFlat({}, scatterAttrs.mode, {dflt: 'markers'}),
51+
4952
text: extendFlat({}, scatterAttrs.text, {
5053
description: [
5154
'Sets text elements associated with each (lon,lat) pair',
@@ -56,11 +59,16 @@ module.exports = {
5659
'this trace\'s (lon,lat) or `locations` coordinates.'
5760
].join(' ')
5861
}),
62+
textfont: scatterAttrs.textfont,
63+
textposition: scatterAttrs.textposition,
64+
5965
line: {
6066
color: scatterLineAttrs.color,
6167
width: scatterLineAttrs.width,
6268
dash: scatterLineAttrs.dash
6369
},
70+
connectgaps: scatterAttrs.connectgaps,
71+
6472
marker: extendFlat({}, {
6573
symbol: scatterMarkerAttrs.symbol,
6674
opacity: scatterMarkerAttrs.opacity,
@@ -76,11 +84,25 @@ module.exports = {
7684
},
7785
colorAttributes('marker')
7886
),
79-
textfont: scatterAttrs.textfont,
80-
textposition: scatterAttrs.textposition,
87+
88+
fill: {
89+
valType: 'enumerated',
90+
values: ['none', 'toself'],
91+
dflt: 'none',
92+
role: 'style',
93+
description: [
94+
'Sets the area to fill with a solid color.',
95+
'Use with `fillcolor` if not *none*.',
96+
'*toself* connects the endpoints of the trace (or each segment',
97+
'of the trace if it has gaps) into a closed shape.'
98+
].join(' ')
99+
},
100+
fillcolor: scatterAttrs.fillcolor,
101+
81102
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
82103
flags: ['lon', 'lat', 'location', 'text', 'name']
83104
}),
105+
84106
_nestedModules: {
85107
'marker.colorbar': 'Colorbar'
86108
}

src/traces/scattergeo/defaults.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var subTypes = require('../scatter/subtypes');
1515
var handleMarkerDefaults = require('../scatter/marker_defaults');
1616
var handleLineDefaults = require('../scatter/line_defaults');
1717
var handleTextDefaults = require('../scatter/text_defaults');
18+
var handleFillColorDefaults = require('../scatter/fillcolor_defaults');
1819

1920
var attributes = require('./attributes');
2021

@@ -35,6 +36,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3536

3637
if(subTypes.hasLines(traceOut)) {
3738
handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);
39+
coerce('connectgaps');
3840
}
3941

4042
if(subTypes.hasMarkers(traceOut)) {
@@ -45,6 +47,11 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4547
handleTextDefaults(traceIn, traceOut, layout, coerce);
4648
}
4749

50+
coerce('fill');
51+
if(traceOut.fill !== 'none') {
52+
handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);
53+
}
54+
4855
coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+location+text' : undefined);
4956
};
5057

src/traces/scattergeo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ScatterGeo.attributes = require('./attributes');
1515
ScatterGeo.supplyDefaults = require('./defaults');
1616
ScatterGeo.colorbar = require('../scatter/colorbar');
1717
ScatterGeo.calc = require('./calc');
18-
ScatterGeo.plot = require('./plot').plot;
18+
ScatterGeo.plot = require('./plot');
1919

2020
ScatterGeo.moduleType = 'trace';
2121
ScatterGeo.name = 'scattergeo';

0 commit comments

Comments
 (0)