Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3fb5dd3

Browse filesBrowse files
committed
Support dash-array, add mapbox mapping, and mock
1 parent b4dfd57 commit 3fb5dd3
Copy full SHA for 3fb5dd3

File tree

4 files changed

+116
-23
lines changed
Filter options

4 files changed

+116
-23
lines changed

‎src/plots/mapbox/layers.js

Copy file name to clipboardExpand all lines: src/plots/mapbox/layers.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ function convertOpts(opts) {
153153
Lib.extendFlat(paint, {
154154
'line-width': opts.line.width,
155155
'line-color': opts.color,
156-
'line-opacity': opts.opacity
156+
'line-opacity': opts.opacity,
157+
'line-dasharray': opts.line.dash
157158
});
158159
break;
159160

‎src/plots/mapbox/layout_attributes.js

Copy file name to clipboardExpand all lines: src/plots/mapbox/layout_attributes.js
+36-22Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var templatedArray = require('../../plot_api/plot_template').templatedArray;
1919

2020
var fontAttr = fontAttrs({
2121
description: [
22-
'Sets the icon text font.',
22+
'Sets the icon text font (color=mapbox.layer.paint.text-color, size=mapbox.layer.layout.text-size).',
2323
'Has an effect only when `type` is set to *symbol*.'
2424
].join(' ')
2525
});
@@ -71,21 +71,21 @@ var attrs = module.exports = overrideAll({
7171
valType: 'number',
7272
dflt: 1,
7373
role: 'info',
74-
description: 'Sets the zoom level of the map.'
74+
description: 'Sets the zoom level of the map (mapbox.zoom).'
7575
},
7676
bearing: {
7777
valType: 'number',
7878
dflt: 0,
7979
role: 'info',
80-
description: 'Sets the bearing angle of the map (in degrees counter-clockwise from North).'
80+
description: 'Sets the bearing angle of the map in degrees counter-clockwise from North (mapbox.bearing).'
8181
},
8282
pitch: {
8383
valType: 'number',
8484
dflt: 0,
8585
role: 'info',
8686
description: [
8787
'Sets the pitch angle of the map',
88-
'(in degrees, where *0* means perpendicular to the surface of the map).'
88+
'(in degrees, where *0* means perpendicular to the surface of the map) (mapbox.pitch).'
8989
].join(' ')
9090
},
9191

@@ -113,7 +113,7 @@ var attrs = module.exports = overrideAll({
113113
valType: 'any',
114114
role: 'info',
115115
description: [
116-
'Sets the source data for this layer.',
116+
'Sets the source data for this layer (mapbox.layer.source).',
117117
'Source can be either a URL,',
118118
'a geojson object (with `sourcetype` set to *geojson*)',
119119
'or an array of tile URLS (with `sourcetype` set to *vector*).'
@@ -125,7 +125,7 @@ var attrs = module.exports = overrideAll({
125125
dflt: '',
126126
role: 'info',
127127
description: [
128-
'Specifies the layer to use from a vector tile source.',
128+
'Specifies the layer to use from a vector tile source (mapbox.layer.source-layer).',
129129
'Required for *vector* source type that supports multiple layers.'
130130
].join(' ')
131131
},
@@ -136,7 +136,7 @@ var attrs = module.exports = overrideAll({
136136
dflt: 'circle',
137137
role: 'info',
138138
description: [
139-
'Sets the layer type.',
139+
'Sets the layer type (mapbox.layer.type).',
140140
'Support for *raster*, *background* types is coming soon.',
141141
'Note that *line* and *fill* are not compatible with Point',
142142
'GeoJSON geometries.'
@@ -161,10 +161,10 @@ var attrs = module.exports = overrideAll({
161161
role: 'style',
162162
description: [
163163
'Sets the primary layer color.',
164-
'If `type` is *circle*, color corresponds to the circle color',
165-
'If `type` is *line*, color corresponds to the line color',
166-
'If `type` is *fill*, color corresponds to the fill color',
167-
'If `type` is *symbol*, color corresponds to the icon color'
164+
'If `type` is *circle*, color corresponds to the circle color (mapbox.layer.paint.circle-color)',
165+
'If `type` is *line*, color corresponds to the line color (mapbox.layer.paint.line-color)',
166+
'If `type` is *fill*, color corresponds to the fill color (mapbox.layer.paint.fill-color)',
167+
'If `type` is *symbol*, color corresponds to the icon color (mapbox.layer.paint.icon-color)'
168168
].join(' ')
169169
},
170170
opacity: {
@@ -173,7 +173,13 @@ var attrs = module.exports = overrideAll({
173173
max: 1,
174174
dflt: 1,
175175
role: 'info',
176-
description: 'Sets the opacity of the layer.'
176+
description: [
177+
'Sets the opacity of the layer.',
178+
'If `type` is *circle*, opacity corresponds to the circle opacity (mapbox.layer.paint.circle-opacity)',
179+
'If `type` is *line*, opacity corresponds to the line opacity (mapbox.layer.paint.line-opacity)',
180+
'If `type` is *fill*, opacity corresponds to the fill opacity (mapbox.layer.paint.fill-opacity)',
181+
'If `type` is *symbol*, opacity corresponds to the icon/text opacity (mapbox.layer.paint.text-opacity)'
182+
].join(' ')
177183
},
178184
minzoom: {
179185
valType: 'number',
@@ -182,8 +188,8 @@ var attrs = module.exports = overrideAll({
182188
dflt: 0,
183189
role: 'info',
184190
description: [
185-
'Sets the minimum zoom level.',
186-
'At zoom levels less than the minzoom, the layer will be hidden.'
191+
'Sets the minimum zoom level (mapbox.layer.minzoom).',
192+
'At zoom levels less than the minzoom, the layer will be hidden.',
187193
].join(' ')
188194
},
189195
maxzoom: {
@@ -193,7 +199,7 @@ var attrs = module.exports = overrideAll({
193199
dflt: 24,
194200
role: 'info',
195201
description: [
196-
'Sets the maximum zoom level.',
202+
'Sets the maximum zoom level (mapbox.layer.maxzoom).',
197203
'At zoom levels equal to or greater than the maxzoom, the layer will be hidden.'
198204
].join(' ')
199205
},
@@ -205,7 +211,7 @@ var attrs = module.exports = overrideAll({
205211
dflt: 15,
206212
role: 'style',
207213
description: [
208-
'Sets the circle radius.',
214+
'Sets the circle radius (mapbox.layer.paint.circle-radius).',
209215
'Has an effect only when `type` is set to *circle*.'
210216
].join(' ')
211217
}
@@ -217,7 +223,15 @@ var attrs = module.exports = overrideAll({
217223
dflt: 2,
218224
role: 'style',
219225
description: [
220-
'Sets the line width.',
226+
'Sets the line width (mapbox.layer.paint.line-width).',
227+
'Has an effect only when `type` is set to *line*.'
228+
].join(' ')
229+
},
230+
dash: {
231+
valType: 'data_array',
232+
role: 'style',
233+
description: [
234+
'Sets the length of dashes and gaps (mapbox.layer.paint.line-dasharray).',
221235
'Has an effect only when `type` is set to *line*.'
222236
].join(' ')
223237
}
@@ -229,7 +243,7 @@ var attrs = module.exports = overrideAll({
229243
dflt: defaultLine,
230244
role: 'style',
231245
description: [
232-
'Sets the fill outline color.',
246+
'Sets the fill outline color (mapbox.layer.paint.fill-outline-color).',
233247
'Has an effect only when `type` is set to *fill*.'
234248
].join(' ')
235249
}
@@ -241,7 +255,7 @@ var attrs = module.exports = overrideAll({
241255
dflt: 'marker',
242256
role: 'style',
243257
description: [
244-
'Sets the symbol icon image.',
258+
'Sets the symbol icon image (mapbox.layer.layout.icon-image).',
245259
'Full list: https://www.mapbox.com/maki-icons/'
246260
].join(' ')
247261
},
@@ -250,7 +264,7 @@ var attrs = module.exports = overrideAll({
250264
dflt: 10,
251265
role: 'style',
252266
description: [
253-
'Sets the symbol icon size.',
267+
'Sets the symbol icon size (mapbox.layer.layout.icon-size).',
254268
'Has an effect only when `type` is set to *symbol*.'
255269
].join(' ')
256270
},
@@ -259,7 +273,7 @@ var attrs = module.exports = overrideAll({
259273
dflt: '',
260274
role: 'info',
261275
description: [
262-
'Sets the symbol text.'
276+
'Sets the symbol text (mapbox.layer.layout.text-field).'
263277
].join(' ')
264278
},
265279
placement: {
@@ -268,7 +282,7 @@ var attrs = module.exports = overrideAll({
268282
dflt: 'point',
269283
role: 'info',
270284
description: [
271-
'Sets the symbol placement.',
285+
'Sets the symbol and/or text placement (mapbox.layer.layout.symbol-placement).',
272286
'If `placement` is *point*, the label is placed where the geometry is located',
273287
'If `placement` is *line*, the label is placed along the line of the geometry',
274288
'If `placement` is *line-center*, the label is placed on the center of the geometry',

‎src/plots/mapbox/layout_defaults.js

Copy file name to clipboardExpand all lines: src/plots/mapbox/layout_defaults.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function handleLayerDefaults(layerIn, layerOut) {
7171

7272
if(type === 'line') {
7373
coerce('line.width');
74+
coerce('line.dash');
7475
}
7576

7677
if(type === 'fill') {
+77Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"data": [
3+
{
4+
"type": "scattermapbox"
5+
}
6+
],
7+
"layout": {
8+
"mapbox": {
9+
"style": "outdoors",
10+
"layers": [
11+
{
12+
"sourcetype": "geojson",
13+
"type": "line",
14+
"minzoom": 4,
15+
"maxzoom": 12,
16+
"color": "gray",
17+
"line": {
18+
"dash": [2.5, 1]
19+
},
20+
"source": {
21+
"type": "FeatureCollection",
22+
"features": [
23+
{
24+
"type": "Feature",
25+
"geometry": {
26+
"type": "LineString",
27+
"coordinates": [[-0.5, 52], [0.5, 50]]
28+
},
29+
"properties": {
30+
"title": "Line Text Example"
31+
}
32+
}
33+
]
34+
}
35+
},
36+
{
37+
"sourcetype": "geojson",
38+
"type": "symbol",
39+
"symbol": {
40+
"text": "{title}",
41+
"textfont": {
42+
"size": 10,
43+
"color": "red"
44+
},
45+
"iconsize": 0,
46+
"placement": "line"
47+
},
48+
"source": {
49+
"type": "FeatureCollection",
50+
"features": [
51+
{
52+
"type": "Feature",
53+
"geometry": {
54+
"type": "LineString",
55+
"coordinates": [[-0.5, 52], [0.5, 50]]
56+
},
57+
"properties": {
58+
"title": "Line Text Example"
59+
}
60+
}
61+
]
62+
}
63+
}
64+
],
65+
"zoom": 5,
66+
"center": {
67+
"lon": 0,
68+
"lat": 51
69+
}
70+
},
71+
"showlegend": false,
72+
"height": 450,
73+
"width": 1100,
74+
"autosize": true
75+
}
76+
}
77+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.