Skip to contents

Use these options in ax_plotOptions(), for charts created with apex(type = "waterfall").

Usage

waterfall_opts(
  positive = NULL,
  negative = NULL,
  subtotal = NULL,
  total = NULL,
  connectors = NULL,
  ...
)

Arguments

positive

Color for steps that raise the running total.

negative

Color for steps that lower the running total.

subtotal

Color for subtotal bars.

total

Color for total bars.

connectors

A list of options for the segments joining each bar to the next one: show, color, strokeWidth, strokeDashArray.

...

Additional parameters.

Value

A list of options that can be used in ax_plotOptions().

Note

Corresponds to plotOptions.waterfall in ApexCharts options.

Examples

income <- data.frame(
  step = c("Revenue", "Services", "Cost of sales", "Gross profit",
           "Marketing", "R&D", "Taxes", "Net income"),
  amount = c(420, 130, -190, NA, -80, -65, -45, NA),
  subtotal = c(FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE),
  total = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE)
)
apex(
  data = income,
  mapping = aes(x = step, y = amount, subtotal = subtotal, total = total),
  type = "waterfall"
) %>%
  ax_plotOptions(
    waterfall = waterfall_opts(
      positive = "#2E93FA",
      negative = "#E91E63",
      total = "#546E7A",
      connectors = list(strokeDashArray = 0)
    )
  )