Skip to content

Commit

Permalink
fix(normalization): remove options not needed for normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
quanho committed Jan 8, 2020
1 parent 9141556 commit 44175f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
3 changes: 0 additions & 3 deletions src/expression-modifiers/normalization/_tests_/index.spec.js
Expand Up @@ -26,9 +26,6 @@ describe('normalization', () => {
disabled: false,
primaryDimension: 0,
relativeNumbers: 0,
crossAllDimensions: false,
showExcludedValues: true,
fullNormalization: false,
outputExpression: '',
};
expression = 'Sum([Sales])';
Expand Down
5 changes: 1 addition & 4 deletions src/expression-modifiers/normalization/index.js
Expand Up @@ -7,9 +7,6 @@ const DEFAULT_OPTIONS = {
disabled: false,
primaryDimension: 0,
relativeNumbers: 0,
crossAllDimensions: false,
showExcludedValues: true,
fullNormalization: false,
outputExpression: '',
};

Expand Down Expand Up @@ -41,7 +38,7 @@ function getSumDisregardSelec(expression) {
export default {
translationKey: 'properties.modifier.normalization',

needDimension: helper.needDimension,
needDimension: () => true,

isApplicable({ properties, layout }) {
return helper.isApplicable({
Expand Down
19 changes: 4 additions & 15 deletions src/expression-modifiers/normalization/properties.js
Expand Up @@ -6,6 +6,7 @@ const NORMALIZATION_TYPES = {
RELATIVE_TO_TOTAL_SELECTION: 0,
RELATIVE_TO_DIM_UNIVERSE: 1,
RELATIVE_TO_TOTAL_UNIVERSE: 2,
RELATIVE_TO_TOTAL_WITHIN_GROUP: 3,
};

function getModifierIndex(measure, modifiersRef) {
Expand Down Expand Up @@ -72,7 +73,9 @@ export default function (rootPath, translationKeys = {}) {
})); // To avoid depending on the layout, we use the first dimension in the drill down dimension
},
show(itemData, handler) {
return handler.layout.qHyperCube.qDimensionInfo.length > 1;
const modifier = getModifier(itemData, rootPath);
const { relativeNumbers } = modifier;
return relativeNumbers === NORMALIZATION_TYPES.RELATIVE_TO_TOTAL_WITHIN_GROUP && handler.layout.qHyperCube.qDimensionInfo.length > 1;
},
},
relativeNumbers: {
Expand Down Expand Up @@ -101,20 +104,6 @@ export default function (rootPath, translationKeys = {}) {
},
],
},
crossAllDimensions: {
refFn: data => `${getRef(data, rootPath)}.crossAllDimensions`,
type: 'boolean',
translation: translationKeys.crossAllDimensions || 'properties.modifier.crossAllDimensions',
title: {
translation:
translationKeys.crossAllDimensionsTooltip || 'properties.modifier.normalization.crossAllDimensions.tooltip',
},
schemaIgnore: true,
defaultValue: false,
show(itemData, handler) {
return handler.layout.qHyperCube.qDimensionInfo.length > 1;
},
},
},
show(itemData, handler) {
return helper.isApplicable({ properties: handler.properties });
Expand Down

0 comments on commit 44175f1

Please sign in to comment.