From c816142a5ea08ba95fe5944ef2d590e60e17bbaa Mon Sep 17 00:00:00 2001
From: Matthew Chiang <36670322+Mattc1221@users.noreply.github.com>
Date: Mon, 29 Jan 2024 05:10:11 -0800
Subject: [PATCH] fix(deck.gl Multiple Layer Chart): Add Contour and Heatmap
Layer as options (#25923)
---
.../plugins/legacy-preset-chart-deckgl/src/index.js | 2 ++
.../legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx | 8 ++++----
.../src/layers/Geojson/Geojson.jsx | 4 ++--
.../src/layers/Heatmap/Heatmap.tsx | 2 +-
.../src/layers/Path/Path.jsx | 2 +-
.../src/layers/Polygon/Polygon.jsx | 10 +++++-----
.../src/layers/Scatter/Scatter.jsx | 10 +++++-----
.../src/layers/Screengrid/Screengrid.jsx | 4 ++--
.../legacy-preset-chart-deckgl/src/layers/index.js | 4 ++++
9 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/index.js b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/index.js
index 819964173ed85..fc4aa7fca0151 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/index.js
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/index.js
@@ -26,3 +26,5 @@ export { default as PathChartPlugin } from './layers/Path';
export { default as PolygonChartPlugin } from './layers/Polygon';
export { default as ScatterChartPlugin } from './layers/Scatter';
export { default as ScreengridChartPlugin } from './layers/Screengrid';
+export { default as ContourChartPlugin } from './layers/Contour';
+export { default as HeatmapChartPlugin } from './layers/Heatmap';
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
index 75cf8d09a18ca..07f3b55b8ff04 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/Arc.jsx
@@ -38,16 +38,16 @@ function setTooltipContent(formData) {
{formData.dimension && (
)}
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.jsx
index 263b576ec9a17..07e6972ea9b53 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.jsx
@@ -80,13 +80,13 @@ const recurseGeoJson = (node, propOverrides, extraProps) => {
function setTooltipContent(o) {
return (
- o.object.extraProps && (
+ o.object?.extraProps && (
{Object.keys(o.object.extraProps).map((prop, index) => (
))}
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx
index 2bd1f63ce7996..72d27b2ba72f9 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx
@@ -30,7 +30,7 @@ function setTooltipContent(o: any) {
);
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.jsx
index 0cea73e2b7bae..db47eb023d54c 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.jsx
@@ -26,7 +26,7 @@ import TooltipRow from '../../TooltipRow';
function setTooltipContent(o) {
return (
- o.object.extraProps && (
+ o.object?.extraProps && (
{Object.keys(o.object.extraProps).map((prop, index) => (
{
- const metricLabel = formData.metric.label || formData.metric;
+ const metricLabel = formData?.metric?.label || formData?.metric;
return (
- {o.object.name && (
+ {o.object?.name && (
)}
- {o.object[formData.line_column] && (
+ {o.object?.[formData?.line_column] && (
)}
- {formData.metric && (
+ {formData?.metric && (
)}
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/Scatter.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/Scatter.jsx
index 523752306770c..a08a3819f985e 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/Scatter.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/Scatter.jsx
@@ -38,17 +38,17 @@ function setTooltipContent(formData, verboseMap) {
- {o.object.cat_color && (
+ {o.object?.cat_color && (
)}
- {o.object.metric && (
-
+ {o.object?.metric && (
+
)}
);
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
index 7883dda17ed66..0d5ad72ac7071 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/Screengrid.jsx
@@ -42,12 +42,12 @@ function setTooltipContent(o) {
);
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/index.js b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/index.js
index b77d5bd12c49c..9747a50b1e761 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/index.js
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/index.js
@@ -25,6 +25,8 @@ import { getLayer as deck_scatter } from './Scatter/Scatter';
import { getLayer as deck_geojson } from './Geojson/Geojson';
import { getLayer as deck_arc } from './Arc/Arc';
import { getLayer as deck_polygon } from './Polygon/Polygon';
+import { getLayer as deck_heatmap } from './Heatmap/Heatmap';
+import { getLayer as deck_contour } from './Contour/Contour';
const layerGenerators = {
deck_grid,
@@ -35,6 +37,8 @@ const layerGenerators = {
deck_geojson,
deck_arc,
deck_polygon,
+ deck_heatmap,
+ deck_contour,
};
export default layerGenerators;