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
650 B
JavaScript
24 lines
650 B
JavaScript
import { ScreenGridLayer } 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],
|
|
}));
|
|
|
|
// Passing a layer creator function instead of a layer since the
|
|
// layer needs to be regenerated at each render
|
|
return new ScreenGridLayer({
|
|
id: `screengrid-layer-${fd.slice_id}`,
|
|
data,
|
|
pickable: true,
|
|
cellSizePixels: fd.grid_size,
|
|
minColor: [c.r, c.g, c.b, 0],
|
|
maxColor: [c.r, c.g, c.b, 255 * c.a],
|
|
outline: false,
|
|
getWeight: d => d.weight || 0,
|
|
});
|
|
}
|