View source: R/chart_amTimeSeries.R
amTimeSeries | R Documentation |
amTimeSeries computes a stock chart.
amTimeSeries( data, col_date, col_series, main = "", ylab = "", color = c("#2E2EFE", "#31B404", "#FF4000", "#AEB404"), type = c("line"), bullet = NULL, bulletSize = 2, linetype = c(0, 5, 10, 15, 20), linewidth = c(1, 1, 1, 1, 1, 1), fillAlphas = 0, precision = 1, connect = FALSE, export = FALSE, legend = TRUE, legendPosition = "bottom", legendHidden = FALSE, aggregation = c("Average", "Low", "High", "Sum"), maxSeries = 300, groupToPeriods = c("ss", "mm", "hh", "DD", "MM", "YYYY"), checkGroupToPeriods = TRUE, ZoomButton = data.frame(Unit = "MAX", multiple = 1, label = "All"), ZoomButtonPosition = "bottom", periodFieldsSelection = FALSE, scrollbar = TRUE, scrollbarPosition = "bottom", scrollbarHeight = 40, scrollbarGraph = NULL, cursor = TRUE, cursorValueBalloonsEnabled = TRUE, creditsPosition = "top-right", group = NULL, is_ts_module = FALSE, dataDateFormat = "YYYY-MM-DD JJ:NN:SS", categoryBalloonDateFormats = list(list(period = "YYYY", format = "YYYY"), list(period = "MM", format = "YYYY-MM"), list(period = "WW", format = "YYYY-MM-DD"), list(period = "DD", format = "YYYY-MM-DD"), list(period = "hh", format = "YYYY-MM-DD JJ:NN"), list(period = "mm", format = "YYYY-MM-DD JJ:NN"), list(period = "ss", format = "YYYY-MM-DD JJ:NN:SS"), list(period = "fff", format = "YYYY-MM-DD JJ:NN:SS")), dateFormats = list(list(period = "YYYY", format = "YYYY"), list(period = "MM", format = "MMM"), list(period = "WW", format = "MMM DD"), list(period = "DD", format = "MMM DD"), list(period = "hh", format = "JJ:NN"), list(period = "mm", format = "JJ:NN"), list(period = "ss", format = "JJ:NN:SS"), list(period = "fff", format = "JJ:NN:SS")), thousandsSeparator = " ", decimalSeparator = ".", balloonFontSize = 10, balloonMaxWidth = 400, ... )
data |
|
col_date |
|
col_series |
|
main |
|
ylab |
|
color |
|
type |
|
bullet |
|
bulletSize |
: |
linetype |
: |
linewidth |
: |
fillAlphas |
: |
precision |
|
connect |
|
export |
|
legend |
|
legendPosition |
|
legendHidden |
|
aggregation |
|
maxSeries |
|
groupToPeriods |
|
checkGroupToPeriods |
|
ZoomButton |
|
ZoomButtonPosition |
|
periodFieldsSelection |
|
scrollbar |
|
scrollbarPosition |
|
scrollbarHeight |
|
scrollbarGraph |
|
cursor |
|
cursorValueBalloonsEnabled |
|
creditsPosition |
|
group |
|
is_ts_module |
|
dataDateFormat |
|
categoryBalloonDateFormats |
|
dateFormats |
|
thousandsSeparator |
|
decimalSeparator |
|
balloonFontSize |
|
balloonMaxWidth |
|
... |
other first level attributes |
For dateFormats & categoryBalloonDateFormats
Available periods are: fff - millisecond, ss - second, mm - minute, hh - hour, DD - date, WW - week, MM - month, YYYY - year
Available formats :
Year. The number of Y letters represents digits in the resulting number. I.e.: YY = 05 (always two digits), YYYY = 2005
Month of the year. The output depends on the number of M's: M = 8 (one or two digits), MM = 08 (always two digits), MMM = Aug (3-letter month abbreviation), MMMM = August (full month name)
Week of the year W
Day of the month: D = 7 (one or two digits), DD = 07 (always two digits)
Day of week: E = 2 (single digit day of week), EE = 02 (two-digit day of week), EEE = Tue (3-letter abbreviation of the literal representation of the day of week), EEEE = Tuesday (full day of week name)
Hour: 0-23: J = 3 (one or two digits), JJ = 03 (always two digits)
Hour: 1-24: H = 3 (one or two digits), HH = 03 (always two digits) K Hour in am/pm: 0-11 L Hour in am/pm: 1-12 *
Minute in hour: N = 8 (one or two digits), NN = 08 (always two digits)
Second in minute: S = 5 (one or two digits), SS = 05 (always two digits)
Milliseconds: QQ = 51, QQQ = 051
Other characters Other characters will be displayed as they are without changing them. I.e.:YYYY-MM-DD = 2013-03-01
See online documentation https://datastorm-open.github.io/introduction_ramcharts/ and amChartsAPI
rAmChartsTimeSeriesUI for shiny module, amOptions, amBarplot, amBoxplot, amHist, amPie, amPlot, amTimeSeries, amStockMultiSet, amBullet, amRadar, amWind, amFunnel, amAngularGauge, amSolidGauge, amMekko, amCandlestick, amFloatingBar, amOHLC, amWaterfall
## Not run: 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")) # column / step amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), type = c("column", "step"), fillAlphas = c(1, 0), linewidth = c(0, 1)) # some parameters 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"), aggregation = "Sum") 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") # date formats amTimeSeries(data_stock_2, "date", c("ts1", "ts2"), type = "column", fillAlphas = 1, linewidth = 0, legendHidden = T, categoryBalloonDateFormats = list(list(period = 'YYYY', format = 'YYYY'), list(period='MM', format = 'MM'), list(period = 'WW', format = 'MM-DD'), list(period='DD', format = 'MM-DD'), list(period = 'hh', format = 'MM-DD JJ:NN'), list(period='mm', format = 'MM-DD JJ:NN'), list(period = 'ss', format = 'MM-DD JJ:NN:SS'), list(period='fff', format = 'MM-DD JJ:NN:SS')), dateFormats = list(list(period = 'YYYY', format = 'YYYY'), list(period='MM', format = 'MMMM'), list(period = 'WW', format = 'MMMM-DD'), list(period='DD', format = 'MMMM-DD'), list(period = 'hh', format = 'MM-DD JJ:NN'), list(period='mm', format = 'MM-DD JJ:NN'), list(period = 'ss', format = 'MM-DD JJ:NN:SS'), list(period='fff', format = 'MM-DD JJ:NN:SS'))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.