View source: R/chart_hc_imd_bar.R
chart_hc_imd_bar | R Documentation |
Visualisation creation function: Create highchart object showing bar plot IMD decile distribution.
The chart will be a highchart object for a single series chart with a bar per IMD decile. The parameters supplied will allow basic formatting to be applied to the chart object.
Some chart elements (e.g. title, caption) have been excluded from the function although this can be added to the highcharts object returned from this function.
chart_hc_imd_bar(
df,
imd_col,
value_col,
metric_def,
highlight_core20 = FALSE,
show_lbl = FALSE,
value_dp = 0,
value_prefix = "",
order_of_magnitude = ""
)
df |
A data frame containing data to plot |
imd_col |
String defining name of column within the data that holds the IMD classification (values should be 1 to 10) |
value_col |
String defining name of column within the data that holds the values to be plotted |
metric_def |
String for the metric being reported (will be used as y-axis title and in tooltip) |
highlight_core20 |
Should Core20 be highlighted
|
show_lbl |
Should data labels be shown
|
value_dp |
No. of decimal places to format values to
|
value_prefix |
Any value prefix that should be displayed
|
order_of_magnitude |
Character to identify if figures should be adjusted to specific abbreviation
|
Highchart object for bar chart showing data by IMD decile
# Example code for chart_hc_imd_bar
# create the test data frame
df_imd_data <- data.frame(
IMD = c(1,2,3,4,5,6,7,8,9,10),
VALUE = sample(100000:200000, size = 10 , replace = TRUE)
)
# create chart object
chart_hc_imd_bar(
df = df_imd_data,
imd_col = "IMD",
value_col = "VALUE",
metric_def = "Example cost values",
highlight_core20 = TRUE,
show_lbl = FALSE,
value_dp = 1,
value_prefix = "£",
order_of_magnitude = "k"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.