From 512fb9a0bdd428b94b0c121158b8b15b7631e0fb Mon Sep 17 00:00:00 2001 From: Matthew Chiang <36670322+Mattc1221@users.noreply.github.com> Date: Tue, 10 Oct 2023 04:20:37 -0500 Subject: [PATCH] feat: Add Deck.gl Contour Layer (#24154) --- .../src/layers/Contour/Contour.tsx | 103 +++++ .../src/layers/Contour/controlPanel.ts | 133 +++++++ .../src/layers/Contour/images/thumbnail.png | Bin 0 -> 64889 bytes .../layers/Contour/images/thumbnailLarge.png | Bin 0 -> 207560 bytes .../src/layers/Contour/index.ts | 45 +++ .../legacy-preset-chart-deckgl/src/preset.ts | 2 + .../legacy-preset-chart-deckgl/src/types.ts | 6 + .../types/external.d.ts | 53 ++- .../controls/ContourControl/ContourOption.tsx | 107 ++++++ .../ContourControl/ContourPopoverControl.tsx | 351 ++++++++++++++++++ .../ContourControl/ContourPopoverTrigger.tsx | 60 +++ .../controls/ContourControl/index.tsx | 143 +++++++ .../controls/ContourControl/types.ts | 55 +++ .../DndColumnSelectControl/OptionWrapper.tsx | 11 +- .../controls/DndColumnSelectControl/types.ts | 1 + .../components/controls/TextControl/index.tsx | 2 +- .../src/explore/components/controls/index.js | 2 + superset/viz.py | 21 ++ 18 files changed, 1092 insertions(+), 3 deletions(-) create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/Contour.tsx create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/controlPanel.ts create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/images/thumbnail.png create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/images/thumbnailLarge.png create mode 100644 superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/index.ts create mode 100644 superset-frontend/src/explore/components/controls/ContourControl/ContourOption.tsx create mode 100644 superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx create mode 100644 superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverTrigger.tsx create mode 100644 superset-frontend/src/explore/components/controls/ContourControl/index.tsx create mode 100644 superset-frontend/src/explore/components/controls/ContourControl/types.ts diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/Contour.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/Contour.tsx new file mode 100644 index 0000000000000..2c46bd6fc257f --- /dev/null +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/Contour.tsx @@ -0,0 +1,103 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { ContourLayer } from 'deck.gl'; +import React from 'react'; +import { t } from '@superset-ui/core'; +import { commonLayerProps } from '../common'; +import sandboxedEval from '../../utils/sandbox'; +import { createDeckGLComponent, getLayerType } from '../../factory'; +import { ColorType } from '../../types'; +import TooltipRow from '../../TooltipRow'; + +function setTooltipContent(o: any) { + return ( +
8ryw-{jW#%bkv45K&3NYeFVM}HW{
z*<;W`RY~a;%Y)2blYh>51UOjx^8dZqO)UX{q~9U{Y)y?7Q_HP*1*V``RuBdzhcEe3
z13)huZYW@G=Q$%{LMlSnltGZDM|Cl)pWO$$pGpAL# T^S`YVo4uAz%jJjZr5=8e=E5V-yOG
z%tg4HVq#=ws@MO^taScu65vv)my;9mK*0&F02yEXMF5OGF48BT?|S|gQeFmaUSX^e
zVs=nJ9HI`2>d!~8u-QMz{1kZ5F$qw|B8j$8ku-r|a8wK)6{fzjk->9MnQEE_F`q_`
zkvdtQrn#dfVf$N~RHk`oGei_H5q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