Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
fix(QB-24411): add color.altLabel to color definition
Browse files Browse the repository at this point in the history
  • Loading branch information
enell committed Jan 30, 2024
1 parent 901209c commit 64f4aee
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
19 changes: 19 additions & 0 deletions chart-modules/common/picasso/__tests__/advanced-color.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import AdvancedColorer from '../advanced-colorer';

describe('advanced-color', () => {
describe('resolveColorByPropertyDef', () => {
test('should set labelExpRef when dimension label is expression', () => {
const properties = { byDimDef: { type: 'expression', label: '=1' } };
const isDim = true;
const dimensions = [{}];
const exclDimensions = [];
const measures = {};
const customLabel = undefined;
AdvancedColorer.resolveColorByPropertyDef(properties, isDim, dimensions, exclDimensions, measures, customLabel);

console.log(JSON.stringify(dimensions[0]));

expect(dimensions[0].qAttributeDimensions[0].labelExpRef).toBe('color.altLabel');
});
});
});
4 changes: 4 additions & 0 deletions chart-modules/common/picasso/advanced-colorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ function resolveColorByPropertyDef(properties, isDim, dimensions, exclDimensions
attribExps.isCustomFormatted = isCustomFormatted;
}
}

if (attribExps.label && attribExps.label.charAt(0) === '=') {
attribExps.labelExpRef = 'color.altLabel';
}
break;
case 'libraryItem':
if (!isDim) {
Expand Down
1 change: 1 addition & 0 deletions charts/distributionplot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"build": "nebula build --config ../../nebula.config.js",
"lint": "eslint src",
"start": "nebula serve --type distributionplot --config ../../nebula.config.js",
"start:mfe": "nebula serve --type distributionplot --config ../../nebula.config.js --mfe",
"sense": "nebula sense --partial",
"sense:watch": "node ../../scripts/sense-watch"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ function generateHyperCube(layout, properties, app, translator) {
properties.qUndoExclude.qHyperCubeDef.qInterColumnSortOrder = [1, 0];

return Promise.resolve();

/* eslint-enable no-param-reassign */
}

export default {
Expand Down

0 comments on commit 64f4aee

Please sign in to comment.