Skip to content

Commit

Permalink
wip tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
kanitw committed May 12, 2024
1 parent 40a59dc commit 49c2d91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compile/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export function formatSignalRef({
signal: `${formatExpr(field, format)}`
};
} else {
// FIXME: use the common valid util
return {signal: `isValid(${field}) ? ${field} : ""+${field}`};
}
}
Expand Down Expand Up @@ -290,7 +291,7 @@ export function timeFormat({
}

function formatExpr(field: string, format: string) {
return `format(${field}, "${format || ''}")`;
return `${fieldValidPredicate(field, false)} ? toString(${field}) : format(${field}, "${format || ''}")`;
}

function binNumberFormatExpr(field: string, format: string | Dict<unknown>, formatType: string, config: Config) {
Expand All @@ -313,6 +314,7 @@ export function binFormatExpression(
}
const start = binNumberFormatExpr(startField, format, formatType, config);
const end = binNumberFormatExpr(endField, format, formatType, config);
// FIXME: "null" in the following line is also not right for NaN
return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`;
}

Expand Down

0 comments on commit 49c2d91

Please sign in to comment.