Skip to content

Commit

Permalink
feat(plugin-chart-echarts): crossfilter with single selection in the …
Browse files Browse the repository at this point in the history
…funnel chart (#1211)
  • Loading branch information
xiezhongfu authored and zhaoyongjie committed Nov 26, 2021
1 parent f9a7226 commit 178986a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function EchartsFunnel({
if (values.includes(name)) {
handleChange(values.filter(v => v !== name));
} else {
handleChange([...values, name]);
handleChange([name]);
}
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
sanitizeHtml,
} from '../utils/series';
import { defaultGrid, defaultTooltip } from '../defaults';
import { OpacityEnum } from '../constants';

const percentFormatter = getNumberFormatter(NumberFormats.PERCENT_2_POINT);

Expand Down Expand Up @@ -124,11 +125,13 @@ export default function transformProps(

const transformedData: FunnelSeriesOption[] = data.map(datum => {
const name = extractGroupbyLabel({ datum, groupby, coltypeMapping: {} });
const isFiltered = filterState.selectedValues && !filterState.selectedValues.includes(name);
return {
value: datum[metricLabel],
name,
itemStyle: {
color: colorFn(name),
opacity: isFiltered ? OpacityEnum.SemiTransparent : OpacityEnum.NonTransparent,
},
};
});
Expand Down

0 comments on commit 178986a

Please sign in to comment.