From 5b5fbdc0711c7f95b39a38b8387d4f66f70bca0f Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Wed, 12 Sep 2018 15:39:38 -0700 Subject: [PATCH] remove getColorFromScheme in favor of CategoricalColorNamespace.getScale() for histogram (#5878) --- superset/assets/src/visualizations/Histogram.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset/assets/src/visualizations/Histogram.jsx b/superset/assets/src/visualizations/Histogram.jsx index 6de9829f169f5..44ffafbe99097 100644 --- a/superset/assets/src/visualizations/Histogram.jsx +++ b/superset/assets/src/visualizations/Histogram.jsx @@ -6,7 +6,7 @@ import { chartTheme } from '@data-ui/theme'; import { LegendOrdinal } from '@vx/legend'; import { scaleOrdinal } from '@vx/scale'; import WithLegend from './WithLegend'; -import { getColorFromScheme } from '../modules/colors'; +import { getScale } from '../modules/CategoricalColorNamespace'; const propTypes = { className: PropTypes.string, @@ -48,10 +48,11 @@ class CustomHistogram extends React.PureComponent { yAxisLabel, } = this.props; + const colorFn = getScale(colorScheme).toFunction(); const keys = data.map(d => d.key); const colorScale = scaleOrdinal({ domain: keys, - range: keys.map(key => getColorFromScheme(key, colorScheme)), + range: keys.map(colorFn), }); return (