Skip to content

Commit 1d83d54

Browse files
author
Ben Lerner
committed
style fix: make chart tooltips be theme-aware
(needs a corresponding fix in CPO to finish the style changes)
1 parent 4ce8823 commit 1d83d54

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/js/trove/charts-lib.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,15 +3304,20 @@
33043304
let height = toFixnum(globalOptions['height']);
33053305
const vegaTooltipHandler = new vegaTooltip.Handler({
33063306
formatTooltip: (value, valueToHtml, maxDepth, baseURL) => {
3307-
if (typeof value === 'object') {
3307+
let ans;
3308+
if (typeof value === 'object' && value.title instanceof Array) {
33083309
const { title, ...rest } = value;
33093310
if (title instanceof Array) {
33103311
const titleStr = `<h2>${title.map(valueToHtml).join('<br/>')}</h2>`;
33113312
const restStr = vegaTooltip.formatValue(rest, valueToHtml, maxDepth, baseURL);
3312-
return titleStr + restStr;
3313+
ans = titleStr + restStr;
33133314
}
3315+
} else {
3316+
ans = vegaTooltip.formatValue(value, valueToHtml, maxDepth, baseURL);
33143317
}
3315-
return vegaTooltip.formatValue(value, valueToHtml, maxDepth, baseURL);
3318+
ans = ans.replaceAll("<table>", "<table class=\"pyret-row\">");
3319+
ans = ans.replaceAll("<td class=\"value\">", "<td class=\"value replTextOutput\"> ");
3320+
return ans;
33163321
}
33173322
});
33183323
const view = new vega.View(vega.parse(processed), {

0 commit comments

Comments
 (0)