datastorm-open / rAmCharts

API for Amcharts
48 stars 16 forks source link

Issue with amTimeSeries (groupToPeriods) #85

Closed thomasthomasth closed 5 years ago

thomasthomasth commented 5 years ago

Hi,

I have just started using this package - and my initial impressions are very good. Thank you for putting together such a package! It fills in an important gap in the Shiny World!

There is a slight issue that I have just found while using the package.

It seems to me that something is not working all right when the groupToPeriods parameter is set to monthly. The aggregation works just fine, but the Time series plot yields unexpected results.

Here is a minimal working example: library(rAmCharts) data('data_stock_2') amTimeSeries(data_stock_2, 'date', c('ts1', 'ts2'), groupToPeriods = c("MM"), aggregation = 'High')

For some reason when when monthly aggregations are applied, the aggregation in itself is performed but for each month it shows vertical lines - instead of single nodes assigned to those month. I guess it connects the minimum and maximum values each month. I am not sure if this issue is related with the R package or its related with the JS library itself. But it may be worth investigating.

Thanks,

Tamas

bthieurmel commented 5 years ago

Hi,

You have to always pass the current ts in groupToPeriods :

amTimeSeries(data_stock_2, 'date', c('ts1', 'ts2'), 
             groupToPeriods = c("hh", "MM"), aggregation = 'High'