Last chance! 50% off unlimited learning
Sale ends in
amCandlestick computes a candlestick chart of the given value.
amCandlestick(
data,
xlab = "",
ylab = "",
horiz = FALSE,
positiveColor = "#7f8da9",
negativeColor = "#db4c3c",
names = c("low", "open", "close", "high"),
dataDateFormat = NULL,
minPeriod = ifelse(!is.null(dataDateFormat), "DD", ""),
...
)
data.frame
, dataframe with at least 5 columns:
category, open (numeric), close (numeric), low (numeric),
high (numeric). See data_candleStick1 and data_candleStick2.
character
, label for x-axis.
character
, label for y-axis.
logical
, TRUE for an horizontal chart, FALSE for a vertical one
character
, color for positive values (in hexadecimal).
character
, color for negative values (in hexadecimal).
character
, names for the tooltip. Default set to c("low", "open", "close", "high").
character
, default set to NULL. Even if your chart parses dates,
you can pass them as strings in your dataframe -
all you need to do is to set data date format and the chart will parse dates to date objects.
Check this page for available formats.
Please note that two-digit years (YY) as well as literal month names (MMM) are NOT supported in this setting.
character
, minPeriod Specifies the shortest period of your data.
This should be set only if dataDateFormat is not NULL.
Possible period values:
fff - milliseconds, ss - seconds, mm - minutes, hh - hours, DD - days, MM - months, YYYY - years.
It's also possible to supply a number for increments, i.e. '15mm'
which will instruct the chart that your data is supplied in 15 minute increments.
see amOptions
for more options.
See online documentation https://datastorm-open.github.io/introduction_ramcharts/ and amChartsAPI
amOptions, amBarplot, amBoxplot, amHist, amPie, amPlot, amTimeSeries, amStockMultiSet, amBullet, amRadar, amWind, amFunnel, amAngularGauge, amSolidGauge, amMekko, amCandlestick, amFloatingBar, amOHLC, amWaterfall
data("data_candleStick2")
amCandlestick(data = data_candleStick2)
if (FALSE) {
# Change colors
amCandlestick(data = data_candleStick2, positiveColor = "black", negativeColor = "green")
# Naming the axes
amCandlestick(data = data_candleStick2, xlab = "categories", ylab = "values")
# Rotate the labels for x axis
amCandlestick(data = data_candleStick2, labelRotation = 90)
# Change names
amCandlestick(data = data_candleStick2, names = c("min", "begin", "end", "max"))
# Horizontal chart :
amCandlestick(data = data_candleStick2, horiz = TRUE)
# Parse date
amCandlestick(data = data_candleStick2, dataDateFormat = "YYYY-MM-DD")
# Datas over months
data_candleStick2$category <- c("2015-01-01", "2015-02-01", "2015-03-01",
"2015-04-01", "2015-05-01", "2015-06-01",
"2015-07-01", "2015-08-01", "2015-09-01",
"2015-10-01", "2015-11-01", "2015-12-01")
amCandlestick(data = data_candleStick2, dataDateFormat = "YYYY-MM-DD", minPeriod = "MM")
# Decimal precision
if (requireNamespace("pipeR", quietly = TRUE)) {
require(pipeR)
amCandlestick(data = data_candleStick2, horiz = TRUE) %>>%
setProperties(precision = 2)
}
}
Run the code above in your browser using DataLab