JetBrains / JetBrains/lets-plot

The tooltip format with `{}` in the pattern ignores the default formatting

Open
#484 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1.8k
Forks
60
PR merge metrics
No merged PRs in 30d

Description

When using the '{}' construction in the format pattern, a string representation of the value is substituted into the result.
It would be better to use the default formatted value.

For example, we want to change the content of the axis tooltip by adding a symbol to the value:

```
N = 21
x = [v for v in range(N)]
y0 = [pow(10, v / 10.) for v in range(N)]
y1 = [v * 5 for v in range(N)]
formula = ['10^(x/10)'] * N + ['5*x'] * N
data = dict(x=x * 2, y=y0 + y1, formula=formula)

ggplot(data) + geom_point(aes('x', 'y', color='formula', size='formula')) + scale_size_manual(values=[7, 3]) + scale_y_log10()
```

* default axis tooltip:

Screenshot 2021-11-26 at 14 42 30

* after specifying the format for the y-axis tooltip:
` tooltips=layer_tooltips().format('^y', '{} %'))`
Screenshot 2021-11-26 at 14 42 43

* Expected: `1.58 %`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.