-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Remove comma in thousands #173
Comments
If your data is not missing any year then this could be treated as categorical variable. library(tibble)
library(echarts4r)
data_test <- tibble(
year = seq(1900, 1920, 1),
variable = seq(200, 400, 10)
)
data_test %>%
dplyr::mutate(year = as.factor(year)) %>%
e_charts(year) %>%
e_line(variable) If you are missing years let me know there are other ways that involve some JavaScript. |
Perfect, it works. I just had to remove
I don't have missing years but maybe you should also detail the solution when there are missing years, for future reference. Let me know if you want to answer on SO as well or if I copy-paste your solution. |
Thanks for pointing this out, I fixed that error with To change the label in a more robust way you have to change the formatter, a JavaScript function, in this case it's simply a matter of returning the value as-is but at least it keeps echarts.js from formatting it. library(echarts4r)
data_test <- tibble(
year = c(1900, 1901, 1905),
variable = 1:3
)
label <- list(
formatter = htmlwidgets::JS(
'function(value, index){
return value;
}'
)
)
data_test %>%
e_charts(year) %>%
e_y_axis(variable) %>%
e_line(variable) %>%
e_x_axis(serie = year, axisLabel = label) |
I am reopening this because the solution using JavaScript does not work when I hover the graph whereas the first one (using
Is there a way to keep the second solution, which is more robust, and to remove the comma when hovering the points? |
Yes, there is some documentation on tooltips on the website |
Okay, I put here what I did, just for the record:
However, this doesn't work if I add By the way, there are some errors in the code of some of the examples in the help page. From "In order to customize the tooltip, ...", some chunks of code are repeated and therefore copy-paste does not work. |
I have a plot where the x-axis scale is in thousands, but it corresponds to years so I would like to remove the comma, in order to have
1900
instead of1,900
for example.I don't think that
e_axis_formatter
can do that. Is there a way to remove the comma?I have already posted this question on StackOverflow.
The text was updated successfully, but these errors were encountered: