amTimeSeries: Plotting times series which aggregation

Description Usage Arguments See Also Examples

View source: R/chart_amTimeSeries.R

Description

amTimeSeries computes a stock chart.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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), fillAlphas = 0, precision = 1, export = FALSE,
  legend = TRUE, legendPosition = "bottom", 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", scrollbar = TRUE,
  scrollbarPosition = "bottom", scrollbarHeight = 40,
  creditsPosition = "top-right", group = NULL, ...)

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.

fillAlphas

: numeric, fill. Between 0 (no fill) to 1.

precision

numeric, default set to 1.

export

logical, default set to FALSE. TRUE to display export feature.

legend

boolean, enabled or not legend ? Defaut to TRUE.

legendPosition

character, legend position. Possible values are : "left", "right", "bottom", "top"

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 grouped 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". Or NULL to disable.

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"

scrollbar

boolean, enabled or not scrollbar ? Defaut to TRUE.

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"

group

character, like in dygraphs, for synchronization in shiny or rmarkdown.

...

other first level attributes

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
data("data_stock_2")
amTimeSeries(data_stock_2, "date", c("ts1", "ts2"))

# upper /lower
data <- data_stock_2[1:50, ]
data$ts1low <- data$ts1-100
data$ts1up <- data$ts1+100

amTimeSeries(data, "date", list(c("ts1low", "ts1", "ts1up"), "ts2"))
amTimeSeries(data, "date", list(c("ts1low", "ts1", "ts1up"), "ts2"), 
 color = c("red", "blue"), bullet = c("round", "square"))


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")
             

rAmCharts documentation built on May 19, 2017, 7:21 a.m.

Search within the rAmCharts package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.