Skip to content

Commit

Permalink
fix: small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Donya-qlik committed Oct 25, 2023
1 parent f8965e4 commit d33d726
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/bridgepicassospec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,22 @@ export default function (element, layout, direction, isInteractable, ds) {

const shouldUseFormat = (measureInfo) => !measureInfo.isCustomFormatted && (measureInfo.qIsAutoFormat || measureInfo.qNumFormat.qType === 'U');

const startLabelFn = (cell) => {
const field = 'qMeasureInfo/0';
const setFormatCell = (cell, field) => {
const measureInfo = ds.field(field).raw();
const formatter = ds.field(field).formatter();
const useFormatter = shouldUseFormat(measureInfo);
const formatCell = (cell) => (cell.qNum === 'NaN' ? '-' : formatter(cell.qNum));
const ret = (useFormatter ? formatCell(cell) : cell.qText);
return ret;
return (useFormatter ? formatCell(cell) : cell.qText);
};

const startLabelFn = (cell) => {
const field = 'qMeasureInfo/1';
return setFormatCell(cell, field);
};

const endLabelFn = (cell) => {
const field = 'qMeasureInfo/1';
const measureInfo = ds.field(field).raw();
const formatter = ds.field(field).formatter();
const useFormatter = shouldUseFormat(measureInfo);
const formatCell = (cell) => (cell.qNum === 'NaN' ? '-' : formatter(cell.qNum));
const ret = (useFormatter ? formatCell(cell) : cell.qText);
return ret;
const field = 'qMeasureInfo/0';
return setFormatCell(cell, field);
};

return {
Expand Down Expand Up @@ -187,7 +185,7 @@ export default function (element, layout, direction, isInteractable, ds) {
layout: {
displayOrder: 1
},
data: {
data: {
extract: {
field: 'qDimensionInfo/0',
props: {
Expand Down

0 comments on commit d33d726

Please sign in to comment.