small changes for scatter axis tick values

This commit is contained in:
pvictor 2020-12-04 11:56:02 +01:00
parent 639450cb7d
commit eb01583f51
1 changed files with 14 additions and 6 deletions

View File

@ -255,7 +255,12 @@ multi_type <- function(x) {
range_num <- function(x) { range_num <- function(x) {
if (is.numeric(x) & length(x) > 0) { if (is.numeric(x) & length(x) > 0) {
range(pretty(x)) p <- pretty(x)
list(
values = p,
n = length(p) - 1,
range = range(p)
)
} else { } else {
NULL NULL
} }
@ -342,17 +347,20 @@ config_scatter <- function(range_x, range_y, datetime = FALSE) {
dataLabels = list(enabled = FALSE), dataLabels = list(enabled = FALSE),
xaxis = list( xaxis = list(
type = "numeric", type = "numeric",
min = range_x[1], min = range_x$range[1],
max = range_x[2], max = range_x$range[2],
tickAmount = range_x$n,
# labels = list(formatter = format_num("~r")),
crosshairs = list( crosshairs = list(
show = TRUE, show = TRUE,
stroke = list(dashArray = 0) stroke = list(dashArray = 0)
) )
), ),
yaxis = list( yaxis = list(
min = range_y[1], min = range_y$range[1],
max = range_y[2], max = range_y$range[2],
decimalsInFloat = 3, tickAmount = range_y$n,
labels = list(formatter = format_num("~r")),
tooltip = list( tooltip = list(
enabled = TRUE enabled = TRUE
) )