datastorm-open / rAmCharts

API for Amcharts
48 stars 16 forks source link

Default handling of date/time basis dataset for amStockMultiSet #91

Open remijul opened 4 years ago

remijul commented 4 years ago

Thank you so much for implementing a such excellent library in R ! I noticed a default behavior of amStockMultiSet fonction : when dataset is based on daily basis, the time scale is preserved, however for hourly basis dataset the time scale is aggregated to a daily unit. Then the hourly basis is not preserved.

Do you have a trick to handle a such behavior ?

See just below a minimal example.

library(rAmCharts)

Minimal example 1 : hourly basis data frame

hour <- seq(from=as.POSIXct("2019-9-25 0:00", tz="GMT"), to=as.POSIXct("2019-9-26 0:00", tz="GMT"), by="hour")

df1 <- data.frame(date = hour, value1 = sample(1:100, size = length(hour), replace = TRUE))

df2 <- data.frame(date = hour, value1 = sample(1:200, size = length(hour), replace = TRUE))

data1 <- list("1" = df1, "2" = df2)

amStockMultiSet(data = data1)

Minimal example 2 : daily basis data frame

date <- seq(from=as.POSIXct("2019-9-1 0:00", tz="GMT"), to=as.POSIXct("2019-9-30 0:00", tz="GMT"), by="day")

df3 <- data.frame(date = date, value1 = sample(1:100, size = length(date), replace = TRUE))

df4 <- data.frame(date = date, value1 = sample(1:200, size = length(date), replace = TRUE))

data2 <- list("3" = df3, "4" = df4)

amStockMultiSet(data = data2)