Skip to content

Commit

Permalink
fix(plugin-chart-pivot-table): fix displaying column labels (apache#1132
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kgabryje authored and zhaoyongjie committed Nov 25, 2021
1 parent 4791bf9 commit 63df854
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@superset-ui/chart-controls": "0.17.50",
"@superset-ui/core": "0.17.50",
"@superset-ui/react-pivottable": "^0.12.6"
"@superset-ui/react-pivottable": "^0.12.8"
},
"peerDependencies": {
"react": "^16.13.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default function PivotTableChart(props: PivotTableProps) {
emitFilter,
setDataMask,
selectedFilters,
verboseMap,
} = props;

const adaptiveFormatter = getNumberFormatter(valueFormat);
Expand Down Expand Up @@ -202,6 +203,7 @@ export default function PivotTableChart(props: PivotTableProps) {
colSubtotalDisplay: { displayOnTop: colSubtotalPosition },
rowSubtotalDisplay: { displayOnTop: rowSubtotalPosition },
}}
namesMapping={verboseMap}
/>
</Styles>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function transformProps(chartProps: ChartProps) {
formData,
hooks: { setDataMask = () => {} },
filterState,
datasource: { verboseMap = {} },
} = chartProps;
const data = queriesData[0].data as DataRecord[];
const {
Expand Down Expand Up @@ -95,5 +96,6 @@ export default function transformProps(chartProps: ChartProps) {
emitFilter,
setDataMask,
selectedFilters,
verboseMap,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
AdhocMetric,
SetDataMaskHook,
DataRecordValue,
JsonObject,
} from '@superset-ui/core';

export interface PivotTableStylesProps {
Expand Down Expand Up @@ -49,6 +50,7 @@ interface PivotTableCustomizeProps {
setDataMask: SetDataMaskHook;
emitFilter?: boolean;
selectedFilters?: SelectedFiltersType;
verboseMap?: JsonObject;
}

export type PivotTableQueryFormData = QueryFormData &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('PivotTableChart transformProps', () => {
],
hooks: { setDataMask },
filterState: { selectedFilters: {} },
datasource: { verboseMap: {} },
});

it('should transform chart props for viz', () => {
Expand All @@ -53,6 +54,7 @@ describe('PivotTableChart transformProps', () => {
emitFilter: false,
setDataMask,
selectedFilters: {},
verboseMap: {},
});
});
});

0 comments on commit 63df854

Please sign in to comment.