amCandlestick: Plotting candlestick chart using rAmCharts

View source: R/chart_amCandlestick.R

amCandlestickR Documentation

Plotting candlestick chart using rAmCharts

Description

amCandlestick computes a candlestick chart of the given value.

Usage

amCandlestick(
  data,
  xlab = "",
  ylab = "",
  horiz = FALSE,
  positiveColor = "#7f8da9",
  negativeColor = "#db4c3c",
  names = c("low", "open", "close", "high"),
  dataDateFormat = NULL,
  minPeriod = ifelse(!is.null(dataDateFormat), "DD", ""),
  ...
)

Arguments

data

data.frame, dataframe with at least 5 columns: category, open (numeric), close (numeric), low (numeric), high (numeric). See data_candleStick1 and data_candleStick2.

xlab

character, label for x-axis.

ylab

character, label for y-axis.

horiz

logical, TRUE for an horizontal chart, FALSE for a vertical one

positiveColor

character, color for positive values (in hexadecimal).

negativeColor

character, color for negative values (in hexadecimal).

names

character, names for the tooltip. Default set to c("low", "open", "close", "high").

dataDateFormat

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.

minPeriod

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.

References

See online documentation https://datastorm-open.github.io/introduction_ramcharts/ and amChartsAPI

See Also

amOptions, amBarplot, amBoxplot, amHist, amPie, amPlot, amTimeSeries, amStockMultiSet, amBullet, amRadar, amWind, amFunnel, amAngularGauge, amSolidGauge, amMekko, amCandlestick, amFloatingBar, amOHLC, amWaterfall

Examples

data("data_candleStick2")
amCandlestick(data = data_candleStick2)

## Not run: 
# 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) 
}

## End(Not run)



DataKnowledge/rAmCharts documentation built on Oct. 3, 2022, 5:42 a.m.