mirror of
https://github.com/apache/superset.git
synced 2026-06-01 13:49:21 +00:00
* Multi layers DECK.GL viz * Fix tests * rebasing * Fix error handling in chartActions * Addressing comments
24 lines
668 B
JavaScript
24 lines
668 B
JavaScript
import { HexagonLayer } from 'deck.gl';
|
|
|
|
export default function getLayer(formData, payload) {
|
|
const fd = formData;
|
|
const c = fd.color_picker;
|
|
const data = payload.data.features.map(d => ({
|
|
...d,
|
|
color: [c.r, c.g, c.b, 255 * c.a],
|
|
}));
|
|
|
|
return new HexagonLayer({
|
|
id: `hex-layer-${fd.slice_id}`,
|
|
data,
|
|
pickable: true,
|
|
radius: fd.grid_size,
|
|
minColor: [0, 0, 0, 0],
|
|
extruded: fd.extruded,
|
|
maxColor: [c.r, c.g, c.b, 255 * c.a],
|
|
outline: false,
|
|
getElevationValue: points => points.reduce((sum, point) => sum + point.weight, 0),
|
|
getColorValue: points => points.reduce((sum, point) => sum + point.weight, 0),
|
|
});
|
|
}
|