mirror of
https://github.com/apache/superset.git
synced 2026-06-09 09:39:25 +00:00
fix(plugin-chart-echarts): single select in boxPlot x-filtering (#1212)
This commit is contained in:
committed by
Yongjie Zhao
parent
4c6017eaa4
commit
0a56420066
@@ -74,7 +74,7 @@ export default function EchartsBoxPlot({
|
||||
if (values.includes(name)) {
|
||||
handleChange(values.filter(v => v !== name));
|
||||
} else {
|
||||
handleChange([...values, name]);
|
||||
handleChange([name]);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
} from './types';
|
||||
import { extractGroupbyLabel, getColtypesMapping, sanitizeHtml } from '../utils/series';
|
||||
import { defaultGrid, defaultTooltip, defaultYAxis } from '../defaults';
|
||||
import { OpacityEnum } from '../constants';
|
||||
|
||||
export default function transformProps(
|
||||
chartProps: EchartsBoxPlotChartProps,
|
||||
@@ -63,6 +64,7 @@ export default function transformProps(
|
||||
});
|
||||
return metricLabels.map(metric => {
|
||||
const name = metricLabels.length === 1 ? groupbyLabel : `${groupbyLabel}, ${metric}`;
|
||||
const isFiltered = filterState.selectedValues && !filterState.selectedValues.includes(name);
|
||||
return {
|
||||
name,
|
||||
value: [
|
||||
@@ -77,7 +79,7 @@ export default function transformProps(
|
||||
],
|
||||
itemStyle: {
|
||||
color: colorFn(groupbyLabel),
|
||||
opacity: 0.6,
|
||||
opacity: isFiltered ? OpacityEnum.SemiTransparent : 0.6,
|
||||
borderColor: colorFn(groupbyLabel),
|
||||
},
|
||||
};
|
||||
@@ -96,6 +98,7 @@ export default function transformProps(
|
||||
const name = metricLabels.length === 1 ? groupbyLabel : `${groupbyLabel}, ${metric}`;
|
||||
// Outlier data is a nested array of numbers (uncommon, therefore no need to add to DataRecordValue)
|
||||
const outlierDatum = (datum[`${metric}__outliers`] || []) as number[];
|
||||
const isFiltered = filterState.selectedValues && !filterState.selectedValues.includes(name);
|
||||
return {
|
||||
name: 'outlier',
|
||||
type: 'scatter',
|
||||
@@ -111,6 +114,7 @@ export default function transformProps(
|
||||
},
|
||||
itemStyle: {
|
||||
color: colorFn(groupbyLabel),
|
||||
opacity: isFiltered ? OpacityEnum.SemiTransparent : OpacityEnum.NonTransparent,
|
||||
},
|
||||
};
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user