vega/vega-tooltip

Have an option to make the tooltip align floating points (or at least align right)

kanitw opened this issue · 10 comments

image

Currently it's a bit hard to compare.

We may also want to consider using a monospace font for numbers to facilitate alignment.

I agree! Ideally we align to the decimal point.

I don't know whether we have a way of knowing whether something is a number since we don't format them. It's all coming from Vega.

I think we can try to convert to number. If something is a number, then we won't get NaN. :)

wouldn't we throw away formatting like trailing 0s?

We can just do the conversion just to check if something is a number. Then align the dots in floating points in real time since there won't be that many variables to show on a tooltip anyway.

What if the locale dictates , instead of . to separate the non-fraction from the fraction part?

That's a bug that a German should fix. :p

Joke aside I'm sure one can read the locale and adjust the delimiter

Jep, just wanted to make sure we think through the potential problems.

We should also make sure numbers have the same width. See https://medium.com/mission-log/design-better-data-tables-430a30a00d8c (e.g. with font-variant-numeric: lining-nums tabular-nums;).