You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by se...@apache.org on 2022/04/20 16:36:38 UTC
[superset] branch master updated: fix(world-map): remove categorical color option (#19781)
This is an automated email from the ASF dual-hosted git repository.
serena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 5e468f7a4c fix(world-map): remove categorical color option (#19781)
5e468f7a4c is described below
commit 5e468f7a4cccc496ccafa52f9aba5b7688145fe4
Author: serenajiang <se...@airbnb.com>
AuthorDate: Wed Apr 20 09:36:28 2022 -0700
fix(world-map): remove categorical color option (#19781)
---
.../legacy-plugin-chart-world-map/src/WorldMap.js | 24 ++++++----------------
.../src/controlPanel.ts | 4 ----
.../src/transformProps.js | 12 ++---------
3 files changed, 8 insertions(+), 32 deletions(-)
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
index 0c81e98560..c7253e10d0 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
@@ -23,7 +23,6 @@ import { extent as d3Extent } from 'd3-array';
import {
getNumberFormatter,
getSequentialSchemeRegistry,
- CategoricalColorNamespace,
} from '@superset-ui/core';
import Datamap from 'datamaps/dist/datamaps.world.min';
@@ -56,8 +55,6 @@ function WorldMap(element, props) {
showBubbles,
linearColorScheme,
color,
- colorScheme,
- sliceId,
} = props;
const div = d3.select(element);
div.classed('superset-legacy-chart-world-map', true);
@@ -72,24 +69,15 @@ function WorldMap(element, props) {
.domain([extRadius[0], extRadius[1]])
.range([1, maxBubbleSize]);
- const linearColorScale = getSequentialSchemeRegistry()
+ const colorScale = getSequentialSchemeRegistry()
.get(linearColorScheme)
.createLinearScale(d3Extent(filteredData, d => d.m1));
- const colorScale = CategoricalColorNamespace.getScale(colorScheme);
-
- const processedData = filteredData.map(d => {
- let color = linearColorScale(d.m1);
- if (colorScheme) {
- // use color scheme instead
- color = colorScale(d.name, sliceId);
- }
- return {
- ...d,
- radius: radiusScale(Math.sqrt(d.m2)),
- fillColor: color,
- };
- });
+ const processedData = filteredData.map(d => ({
+ ...d,
+ radius: radiusScale(Math.sqrt(d.m2)),
+ fillColor: colorScale(d.m1),
+ }));
const mapData = {};
processedData.forEach(d => {
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
index 91664290dc..ec8aafc7b8 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts
@@ -106,7 +106,6 @@ const config: ControlPanelConfig = {
},
],
['color_picker'],
- ['color_scheme'],
['linear_color_scheme'],
],
},
@@ -127,9 +126,6 @@ const config: ControlPanelConfig = {
color_picker: {
label: t('Bubble Color'),
},
- color_scheme: {
- label: t('Categorical Color Scheme'),
- },
linear_color_scheme: {
label: t('Country Color Scheme'),
},
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js
index 3838ebfa5c..464dd53afa 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js
@@ -20,14 +20,8 @@ import { rgb } from 'd3-color';
export default function transformProps(chartProps) {
const { width, height, formData, queriesData } = chartProps;
- const {
- maxBubbleSize,
- showBubbles,
- linearColorScheme,
- colorPicker,
- colorScheme,
- sliceId,
- } = formData;
+ const { maxBubbleSize, showBubbles, linearColorScheme, colorPicker } =
+ formData;
const { r, g, b } = colorPicker;
return {
@@ -38,7 +32,5 @@ export default function transformProps(chartProps) {
showBubbles,
linearColorScheme,
color: rgb(r, g, b).hex(),
- colorScheme,
- sliceId,
};
}