R/columnmulticolor.R

Defines functions ColumnMultiColor

Documented in ColumnMultiColor

#' ColumnMultiColor
#'
#' Column charts with many colors
#' @inherit Column
#' @importFrom flipChartBasics ChartColors
#' @importFrom plotly plot_ly layout
#' @export
ColumnMultiColor <- function(x,
                    x2 = NULL,
                    annotation.list = NULL,
                    overlay.annotation.list = NULL,
                    colors = ChartColors(max(1, length(x))),
                    opacity = NULL,
                    fit.type = "None", # can be "Smooth" or anything else
                    fit.window.size = 2,
                    fit.line.colors = colors,
                    fit.ignore.last = FALSE,
                    fit.line.type = "dot",
                    fit.line.width = 1,
                    fit.line.name = "Fitted",
                    fit.line.opacity = 1,
                    fit.CI.show = FALSE,
                    fit.CI.colors = fit.line.colors,
                    fit.CI.opacity = 0.4,
                    global.font.family = "Arial",
                    global.font.color = rgb(44, 44, 44, maxColorValue = 255),
                    title = "",
                    title.font.family = global.font.family,
                    title.font.color = global.font.color,
                    title.font.size = 16,
                    title.align = "center",
                    subtitle = "",
                    subtitle.font.family = global.font.family,
                    subtitle.font.color = global.font.color,
                    subtitle.font.size = 12,
                    subtitle.align = "center",
                    footer = "",
                    footer.font.family = global.font.family,
                    footer.font.color = global.font.color,
                    footer.font.size = 8,
                    footer.align = "center",
                    footer.wrap = TRUE,
                    footer.wrap.nchar = 100,
                    background.fill.color = "transparent",
                    background.fill.opacity = 1,
                    charting.area.fill.color = background.fill.color,
                    charting.area.fill.opacity = 0,
                    legend.show = NA,
                    legend.orientation = "Vertical",
                    legend.wrap = TRUE,
                    legend.wrap.nchar = 30,
                    legend.position.x = NULL,
                    legend.position.y = NULL,
                    legend.ascending = NA,
                    legend.fill.color = background.fill.color,
                    legend.fill.opacity = 0,
                    legend.border.color = rgb(44, 44, 44, maxColorValue = 255),
                    legend.border.line.width = 0,
                    legend.font.color = global.font.color,
                    legend.font.family = global.font.family,
                    legend.font.size = 10,
                    margin.top = NULL,
                    margin.bottom = NULL,
                    margin.left = NULL,
                    margin.right = NULL,
                    margin.inner.pad = NULL,
                    margin.autoexpand = TRUE,
                    grid.show = TRUE,
                    average.series = NULL,
                    average.color = rgb(230, 230, 230, maxColorValue = 255),
                    x2.colors = ChartColors(max(1, NCOL(x2), na.rm = TRUE)),
                    x2.data.label.show = FALSE,
                    x2.data.label.show.at.ends = FALSE,
                    x2.line.type = "Solid",
                    x2.line.thickness = 2,
                    x2.shape = c("linear", "spline")[1],
                    x2.smoothing = 1,
                    x2.opacity = 1,
                    x2.marker.show = FALSE,
                    x2.marker.show.at.ends = FALSE,
                    x2.marker.size = 6,
                    x2.marker.symbols = "circle",
                    x2.marker.colors = x2.colors,
                    x2.marker.border.colors = x2.colors,
                    x2.marker.opacity = x2.opacity,
                    x2.marker.border.opacity = x2.opacity,
                    x2.marker.border.width = 1,
                    x2.data.label.position = "Top",
                    x2.data.label.font.autocolor = FALSE,
                    x2.data.label.font.family = global.font.family,
                    x2.data.label.font.size = 10,
                    x2.data.label.font.color = global.font.color,
                    x2.data.label.format = "",
                    x2.data.label.prefix = "",
                    x2.data.label.suffix = "",
                    y2.title = "",
                    y2.title.font.color = global.font.color,
                    y2.title.font.family = global.font.family,
                    y2.title.font.size = 12,
                    y2.line.width = 0,
                    y2.line.color = rgb(0, 0, 0, maxColorValue = 255),
                    y2.tick.mark.length = 0,
                    y2.tick.mark.color = "tranparent",
                    y2.bounds.minimum = NULL,
                    y2.bounds.maximum = NULL,
                    y2.tick.distance = NULL,
                    y2.tick.maxnum = NULL,
                    y2.zero = TRUE,
                    y2.zero.line.width = 0,
                    y2.zero.line.color = rgb(225, 225, 225, maxColorValue = 255),
                    y2.data.reversed = FALSE,
                    y2.grid.width = 0 * grid.show,
                    y2.grid.color = rgb(225, 225, 225, maxColorValue = 255),
                    y2.tick.show = TRUE,
                    y2.tick.suffix = "",
                    y2.tick.prefix = "",
                    y2.tick.format = "",
                    y2.hovertext.format = y2.tick.format,
                    y2.tick.angle = NULL,
                    y2.tick.font.color = global.font.color,
                    y2.tick.font.family = global.font.family,
                    y2.tick.font.size = 10,
                    y.title = "",
                    y.title.font.color = global.font.color,
                    y.title.font.family = global.font.family,
                    y.title.font.size = 12,
                    y.line.width = 0,
                    y.line.color = rgb(0, 0, 0, maxColorValue = 255),
                    y.tick.mark.length = 0,
                    y.tick.mark.color = "transparent",
                    y.bounds.minimum = NULL,
                    y.bounds.maximum = NULL,
                    y.tick.distance = NULL,
                    y.tick.maxnum = NULL,
                    y.zero = FALSE,
                    y.zero.line.width = 0,
                    y.zero.line.color = rgb(225, 225, 225, maxColorValue = 255),
                    y.data.reversed = FALSE,
                    y.grid.width = 1 * grid.show,
                    y.grid.color = rgb(225, 225, 225, maxColorValue = 255),
                    y.tick.show = TRUE,
                    y.tick.suffix = "",
                    y.tick.prefix = "",
                    y.tick.format= "",
                    y.hovertext.format= y.tick.format,
                    y.tick.angle = NULL,
                    y.tick.font.color = global.font.color,
                    y.tick.font.family = global.font.family,
                    y.tick.font.size = 10,
                    x.title = "",
                    x.title.font.color = global.font.color,
                    x.title.font.family = global.font.family,
                    x.title.font.size = 12,
                    x.line.width = 0,
                    x.line.color = rgb(0, 0, 0, maxColorValue = 255),
                    x.tick.marks = "",
                    x.tick.mark.length = 3,
                    x.tick.mark.color = "transparent",
                    x.bounds.minimum = NULL,
                    x.bounds.maximum = NULL,
                    x.tick.distance = NULL,
                    x.tick.maxnum = 11,
                    x.zero = FALSE,
                    x.zero.line.width = 0,
                    x.zero.line.color = rgb(225, 225, 225, maxColorValue = 255),
                    x.data.reversed = FALSE,
                    x.grid.width = 0 * grid.show,
                    x.grid.color = rgb(225, 225, 225, maxColorValue = 255),
                    x.tick.show = TRUE,
                    x.tick.suffix = "",
                    x.tick.prefix = "",
                    x.tick.format = "",
                    x.tick.angle = NULL,
                    x.tick.font.color = global.font.color,
                    x.tick.font.family = global.font.family,
                    x.tick.font.size = 10,
                    x.tick.label.wrap = TRUE,
                    x.tick.label.wrap.nchar = 21,
                    hovertext.font.family = global.font.family,
                    hovertext.font.size = 11,
                    hovertext.template = NULL,
                    hovertext.align = "left",
                    marker.border.width = 1,
                    marker.border.colors = colors,
                    marker.border.opacity = NULL,
                    data.label.show = FALSE,
                    data.label.font.autocolor = FALSE,
                    data.label.font.family = global.font.family,
                    data.label.font.size = 10,
                    data.label.font.color = global.font.color,
                    data.label.format = "",
                    data.label.prefix = "",
                    data.label.suffix = "",
                    data.label.threshold = NULL,
                    x.hovertext.format = x.tick.format,
                    tooltip.show = TRUE,
                    modebar.show = FALSE,
                    zoom.enable = TRUE,
                    axis.drag.enable = FALSE,
                    bar.gap = 0.15)
{
    eval(colors)
    cl <- match.call()
    cl <- c(cl[1], lapply(cl[-1], evalc, env = parent.frame()))
    cl <- as.call(cl)
    cl <- cl[-1]
    cl$colors <- colors
    cl$multi.colors.within.series <- TRUE
    do.call(Column, as.list(cl))
}
NumbersInternational/flipStandardCharts documentation built on May 2, 2024, 11:17 p.m.