@record-evolution/widget-mapbox 1.4.16 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-mapbox.js +37 -41
- package/dist/widget-mapbox.js.map +1 -1
- package/package.json +1 -1
- package/src/definition-schema.json +3 -1
- package/src/widget-mapbox.ts +23 -25
package/package.json
CHANGED
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"properties": {
|
|
95
95
|
"circle-blur": {
|
|
96
96
|
"title": "Blur",
|
|
97
|
+
"description": "Blur of 1 means the whole circle is blurred starting from the center point. Blur 0 means no blur effect.",
|
|
97
98
|
"min": 0,
|
|
98
99
|
"max": 1,
|
|
99
100
|
"type": "number",
|
|
@@ -101,6 +102,7 @@
|
|
|
101
102
|
},
|
|
102
103
|
"circle-opacity": {
|
|
103
104
|
"title": "Opacity",
|
|
105
|
+
"description": "Opactity 1 means fully opaque, 0 means fully transparent.",
|
|
104
106
|
"min": 0,
|
|
105
107
|
"max": 1,
|
|
106
108
|
"type": "number",
|
|
@@ -109,7 +111,7 @@
|
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
113
|
"symbol": {
|
|
112
|
-
"title": "
|
|
114
|
+
"title": "Symbol Layer",
|
|
113
115
|
"type": "object",
|
|
114
116
|
"order": 2,
|
|
115
117
|
"properties": {
|
package/src/widget-mapbox.ts
CHANGED
|
@@ -63,7 +63,7 @@ export class WidgetMapbox extends LitElement {
|
|
|
63
63
|
})
|
|
64
64
|
})
|
|
65
65
|
if (bounds.isEmpty()) {
|
|
66
|
-
bounds.extend([8.6820917, 50.1106444])
|
|
66
|
+
bounds.extend([8.6820917, 50.1106444]) // Frankfurt
|
|
67
67
|
}
|
|
68
68
|
this.map.fitBounds(bounds, { maxZoom: 14, padding: 16, duration: 100 })
|
|
69
69
|
}
|
|
@@ -83,7 +83,7 @@ export class WidgetMapbox extends LitElement {
|
|
|
83
83
|
}
|
|
84
84
|
})
|
|
85
85
|
// console.log('The input data', this.inputData.dataseries[0], this.inputData.dataseries[1])
|
|
86
|
-
// Pivot
|
|
86
|
+
// Pivot data if required
|
|
87
87
|
this.dataSets = []
|
|
88
88
|
this.inputData.dataseries.forEach((ds) => {
|
|
89
89
|
const color = this.colors.get(ds.label)
|
|
@@ -91,23 +91,20 @@ export class WidgetMapbox extends LitElement {
|
|
|
91
91
|
const derivedColors = tinycolor(color)
|
|
92
92
|
.monochromatic(distincts.length)
|
|
93
93
|
.map((c: any) => c.toHexString())
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
ds.color = ds.color ?? this.colors[ds.label]
|
|
109
|
-
this.dataSets.push(ds)
|
|
110
|
-
}
|
|
94
|
+
|
|
95
|
+
distincts.forEach((piv, i) => {
|
|
96
|
+
const prefix = piv ? `${piv} - ` : ''
|
|
97
|
+
const pds: any = {
|
|
98
|
+
label: prefix + ds.label ?? '',
|
|
99
|
+
order: ds.order,
|
|
100
|
+
type: ds.type,
|
|
101
|
+
latestValues: ds.latestValues,
|
|
102
|
+
color: derivedColors[i],
|
|
103
|
+
config: ds.config,
|
|
104
|
+
data: distincts.length === 1 ? ds.data : ds.data?.filter((d) => d.pivot === piv)
|
|
105
|
+
}
|
|
106
|
+
this.dataSets.push(pds)
|
|
107
|
+
})
|
|
111
108
|
})
|
|
112
109
|
|
|
113
110
|
this.inputData.dataseries = []
|
|
@@ -193,7 +190,8 @@ export class WidgetMapbox extends LitElement {
|
|
|
193
190
|
type: 'circle',
|
|
194
191
|
source: 'input:' + dataSet.label,
|
|
195
192
|
paint: {
|
|
196
|
-
|
|
193
|
+
'circle-blur': dataSet.config?.['circle']?.['circle-blur'] ?? 0,
|
|
194
|
+
'circle-opacity': dataSet.config?.['circle']?.['circle-opacity'] ?? 1,
|
|
197
195
|
'circle-radius': ['get', 'value'],
|
|
198
196
|
'circle-radius-transition': {
|
|
199
197
|
duration: 1000,
|
|
@@ -214,11 +212,11 @@ export class WidgetMapbox extends LitElement {
|
|
|
214
212
|
source: 'input:' + dataSet.label,
|
|
215
213
|
layout: {
|
|
216
214
|
'text-field': ['get', 'value'],
|
|
217
|
-
'text-size': dataSet.config['symbol']['text-size'],
|
|
215
|
+
'text-size': dataSet.config['symbol']?.['text-size'] ?? 14,
|
|
218
216
|
'text-anchor': 'center'
|
|
219
217
|
},
|
|
220
218
|
paint: {
|
|
221
|
-
'text-color': dataSet.config['symbol']['text-color']
|
|
219
|
+
'text-color': dataSet.config['symbol']?.['text-color'] ?? '#000'
|
|
222
220
|
}
|
|
223
221
|
// Place polygons under labels, roads and buildings.
|
|
224
222
|
// 'aeroway-polygon'
|
|
@@ -234,7 +232,7 @@ export class WidgetMapbox extends LitElement {
|
|
|
234
232
|
source: 'input:' + dataSet.label,
|
|
235
233
|
layout: {
|
|
236
234
|
'text-field': ['get', 'value'],
|
|
237
|
-
'text-size': dataSet.config?.['symbol']?.['text-size'],
|
|
235
|
+
'text-size': dataSet.config?.['symbol']?.['text-size'] ?? 14,
|
|
238
236
|
'text-anchor': 'center',
|
|
239
237
|
'icon-image': dataSet.config?.symbol?.['icon-image'],
|
|
240
238
|
'icon-size': dataSet.config?.symbol?.['icon-size']
|
|
@@ -341,8 +339,8 @@ export class WidgetMapbox extends LitElement {
|
|
|
341
339
|
type: 'symbol',
|
|
342
340
|
source: 'input:' + dataSet.label,
|
|
343
341
|
layout: {
|
|
344
|
-
'icon-image': dataSet.config.symbol['icon-image'],
|
|
345
|
-
'icon-size': dataSet.config.symbol['icon-size']
|
|
342
|
+
'icon-image': dataSet.config.symbol?.['icon-image'],
|
|
343
|
+
'icon-size': dataSet.config.symbol?.['icon-size']
|
|
346
344
|
},
|
|
347
345
|
paint: {
|
|
348
346
|
'icon-color': dataSet.color
|