Skip to content

Commit

Permalink
remove getColorFromScheme in favor of CategoricalColorNamespace.getSc…
Browse files Browse the repository at this point in the history
…ale() for histogram (apache#5878)
  • Loading branch information
kristw authored and betodealmeida committed Oct 12, 2018
1 parent c6ee603 commit 5b5fbdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions superset/assets/src/visualizations/Histogram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit 5b5fbdc

Please sign in to comment.