Learn R Programming

rAmCharts (version 2.0.3)

amTimeSeries: Plotting times series which aggregation

Description

amTimeSeries computes a stock chart.

Usage

amTimeSeries(data, col_date, col_series, main = "", ylab = "", color = c("#2E2EFE", "#31B404", "#FF4000", "#AEB404"), bullet = NULL, bulletSize = 2, linetype = c(0, 5, 10, 15, 20), linewidth = c(1, 1, 1, 1, 1, 1), aggregation = c("Average", "Low", "High", "Sum"), maxSeries = 300, groupToPeriods = c("ss", "mm", "hh", "DD", "MM", "YYYY"), ZoomButton = data.frame(Unit = "MAX", multiple = 1, label = "All"), ZoomButtonPosition = "bottom", precision = 1, export = FALSE, legendPosition = "bottom", scrollbarPosition = "bottom", scrollbarHeight = 40, creditsPosition = "top-right", ...)

Arguments

data
data.frame, data of graph.
col_date
character name of date column
col_series
character names of series columns
main
character, title.
ylab
character, value axis label.
color
character, color of series (in hexadecimal).
bullet
character, point shape. Possible values are : "diamond", "square", "bubble", "yError", "xError", "round", "triangleLeft", "triangleRight", "triangleUp"
bulletSize
: numeric, size of bullet.
linetype
: numeric, line type, 0 : solid, number : dashed length
linewidth
: numeric, line width.
aggregation
character, aggregation type. Possible values are : "Low", "High", "Average" and "Sum"
maxSeries
numeric Maximum series shown at a time. In case there are more data points in the selection than maxSeries, the chart will group data to longer periods, for example - you have 250 days in the selection, and maxSeries is 150 - the chart will group data to weeks.
groupToPeriods
character, Periods to which data will be gruoped in case there are more data items in the selected period than specified in maxSeries property. Possible value are : 'ss', 'mm', 'hh', 'DD', 'MM', 'YYYY'. It's also possible to add multiple like "30mm".
ZoomButton
data.frame, 3 columns : Unit, times unit multiple : multiple*unit label : button's label
ZoomButtonPosition
character, zoom button position. Possible values are : "left", "right", "bottom", "top"
precision
numeric, digits precision
export
logical, default set to FALSE. TRUE to display export feature.
legendPosition
character, legend position. Possible values are : "left", "right", "bottom", "top"
scrollbarPosition
character, scrollbar position. Possible values are : "left", "right", "bottom", "top"
scrollbarHeight
numeric, height of scroll bar. Default : 40.
creditsPosition
character, credits position. Possible values are : "top-right", "top-left", "bottom-right", "bottom-left"
...
other first level attributes

See Also

Examples

Run this code
data("data_stock_2")
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"))


amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round")
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
              groupToPeriods = c('hh', 'DD', '10DD'))

amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
              groupToPeriods = c('12hh', 'DD', '10DD'),
              maxSeries = 50)
              
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
             groupToPeriods = c('hh', 'DD', '10DD'),
             linewidth = c(3, 1))



amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
              groupToPeriods = c('12hh', 'DD', '10DD'),
              maxSeries = 50, precision = 5)

amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet =  c("diamond", "square"),
             linetype = 0, bulletSize = c(5, 10),
             groupToPeriods = c('12hh', 'DD', '10DD'),
             maxSeries = 50, aggregation = "Sum")


ZoomButton <- data.frame(Unit = c("DD", "DD", "MAX"), multiple = c(1, 2 ,1),
                        label = c("Day","2 days", "MAX"))
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
             ZoomButton = ZoomButton, main = "My title", ylab = "Interest")
             
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
             ZoomButton = ZoomButton, main = "My title", ylab = "Interest",
             export = TRUE, ZoomButtonPosition = "right",
             legendPosition = "bottom", scrollbarPosition = "top")
         
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), bullet = "round",
             ZoomButton = ZoomButton, main = "My title",
             ylab = "Interest", export = TRUE,
             creditsPosition = "bottom-left")
             

Run the code above in your browser using DataLab