superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccwilli...@apache.org
Subject [incubator-superset] branch master updated: remove getColorFromScheme in favor of CategoricalColorNamespace.getScale() for histogram (#5878)
Date Wed, 12 Sep 2018 22:39:43 GMT
This is an automated email from the ASF dual-hosted git repository.

ccwilliams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 620beed  remove getColorFromScheme in favor of CategoricalColorNamespace.getScale()
for histogram (#5878)
620beed is described below

commit 620beed867f0f771a76aba79fef6d08021b946f3
Author: Krist Wongsuphasawat <krist.wongz@gmail.com>
AuthorDate: Wed Sep 12 15:39:38 2018 -0700

    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 6de9829..44ffafb 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 (


Mime
View raw message