Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two different tooltips formatter for different axis #645

Open
egoipse opened this issue Oct 16, 2024 · 0 comments
Open

Two different tooltips formatter for different axis #645

egoipse opened this issue Oct 16, 2024 · 0 comments

Comments

@egoipse
Copy link

egoipse commented Oct 16, 2024

Hi!

Great package. Thanks for the hard work.

Is there any chance to get different formatter configuration for tooltips in charts with more than one x or y axis?

Reprex:

library(echarts4r)

read.csv("https://raw.githubusercontent.com/selva86/datasets/refs/heads/master/BostonHousing.csv") |>	
  e_chart(rm) |>
  e_scatter(tax) |>
  e_bar(dis, y_index = 1) |>
  e_x_axis(
    formatter = e_axis_formatter(style = "decimal")
  ) |>
  e_y_axis(
    formatter = e_axis_formatter(style = "currency", currency = "USD")
  ) |>
  e_tooltip(
    "axis",
    formatter = e_tooltip_pointer_formatter(style = "currency", currency = "USD")
  )

The code generates the following chart:

image

Since "tax" is currency data, the style for e_tooltip in formatter was set to "currency". However, the tooltip also shows the currency style for "dis" data, which is not.

Any chance to set one formatter style for "tax" and another one for "dis" (in this case, "decimal")?

As far as I read on documentation, JS is the way to go. Any chance to do it just with R?

Thanks in advance for the answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant