View source: R/createWaterfall.R
createWaterfall | R Documentation |
This function creates a waterfall chart using highcharter. It automatically converts entered values into percentages (percentages are calculated relative to the first value entered). It also automatically converts entered values into a series for plotting and also automatically chooses the color for a given category based on the category's value (positive or negative).
createWaterfall(dfNames, dfValues, isSum, isIntermediateSum, title, subTitle,
xTitle, yTitle)
dfNames |
These are the names of the categories |
dfValues |
These are the values for each category. Intermediate and sum categories should be left as NA. |
isSum |
This is a boolean list of whether the names and values represent a sum in the waterfall chart. |
isIntermediateSum |
This is a boolean list of whether the names and values represent an intermediate sum in the waterfall chart. |
title |
This is the title of the chart |
subTitle |
This is the subtitle of the chart |
xTitle |
This is the title of the x axis. |
yTitle |
This is the title of the y axis. |
dfNames <- c("Trips where passengers paid a surcharge",
"Double counted trips (pickup AND dropoff in special venue)",
"Trips where Uber paid a surcharge and didn't charge the rider",
"Trips where the dropoff did not occur in the current month",
"'Line' trips","Trips where Uber paid a $5 fee to the city")
dfValues <- c(416468,2338,140,72,-1773,NA)
isIntermediateSum = c(0,0,0,0,0,0)
isSum = c(0,0,0,0,0,1)
output$heatmap <- highcharter::renderHighchart({
createWaterfall(dfNames, dfValues, isSum, isIntermediateSum,"Line Trip Reconciliation",
"Cumulative Effect of Adjustments","Adjustment Type","Percent Effect")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.