mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
Added DeckGL.Polygon Layer w/ JS controls (#4227)
* Working polygon layer for deckGL * add js controls * add thumbnail * better description * refactor to leverage line_column controls * templates: open code and documentation on a new tab (#4217) As they are external resources. * Fix tutorial doesn't match the current interface #4138 (#4215) * [bugfix] markup and iframe viz raise 'Empty query' (#4225) closes https://github.com/apache/incubator-superset/issues/4222 Related to: https://github.com/apache/incubator-superset/pull/4016 * [bugfix] time_pivot entry got missing in merge conflict (#4221) PR here https://github.com/apache/incubator-superset/pull/3518 missed a line of code while merging conflicts with time_pivot viz * Improve deck.gl GeoJSON visualization (#4220) * Improve geoJSON * Addressing comments * lint * refactor to leverage line_column controls * refactor to use DeckPathViz * oops
This commit is contained in:
committed by
Maxime Beauchemin
parent
cab8e7d22d
commit
5079b2aa95
28
superset/assets/visualizations/deckgl/layers/polygon.jsx
Normal file
28
superset/assets/visualizations/deckgl/layers/polygon.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { PolygonLayer } from 'deck.gl';
|
||||
|
||||
import * as common from './common';
|
||||
import sandboxedEval from '../../../javascripts/modules/sandbox';
|
||||
|
||||
export default function polygonLayer(formData, payload, slice) {
|
||||
const fd = formData;
|
||||
const fc = fd.fill_color_picker;
|
||||
let data = payload.data.features.map(d => ({
|
||||
...d,
|
||||
fillColor: [fc.r, fc.g, fc.b, 255 * fc.a],
|
||||
}));
|
||||
|
||||
if (fd.js_datapoint_mutator) {
|
||||
// Applying user defined data mutator if defined
|
||||
const jsFnMutator = sandboxedEval(fd.js_datapoint_mutator);
|
||||
data = data.map(jsFnMutator);
|
||||
}
|
||||
|
||||
return new PolygonLayer({
|
||||
id: `path-layer-${fd.slice_id}`,
|
||||
data,
|
||||
filled: fd.filled,
|
||||
stroked: fd.stoked,
|
||||
extruded: fd.extruded,
|
||||
...common.commonLayerProps(fd, slice),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user