Closed Alik-V closed 4 years ago
Hello Alik,
Good week-end at home with the lockdown :p
Yes, using a formatter for y-axis will alter the tooltip, I don't think there's an option to prevent it, but you can use a formatter for tooltip (and for dataLabels too), small example :
apexchart() %>%
# ...
ax_yaxis(
labels = list(
minWidth = 60,
formatter = format_num(".0f") # no decimals
)
) %>%
ax_tooltip(
y = list( # y value in the tooltip
formatter = format_num(".2f") # 2 decimals
)
) %>%
ax_dataLabels( # Value displayed on bars
formatter = format_num(".0f") # no decimals
)
I used format_num
here, that under the hood call d3.format, but your JavaScript function will work the same.
Best,
Victor
Hi Victor,
That worked great, thank you :)
Best wishes, Alik
Hi Victor,
Hope you had a good weekend.
I am having a problem when trying to round-up the numbers on the ticks on y-axis for better appearance. I use formatter option in ax_yaxis for that, and it seems that this function is affecting the apperance of tooltip numbers as well. Is there a way to keep the tooltip numbers unaffected here? Example here:
Thanks! Best wishes, Alik