---
title: "{{< iconify ph chart-pie >}} Standalone Charts"
format: html
---
This page demonstrates standalone charts (no tabsets) for key findings.
For example, you could use this layout to visualize the most important trends or overarching themes of your data.
```{r setup}
#| echo: false
#| warning: false
#| message: false
#| error: false
#| results: 'hide'
# Load required libraries
library(dashboardr)
library(dplyr)
library(highcharter)
# Global chunk options
knitr::opts_chunk$set(
echo = FALSE,
warning = FALSE,
message = FALSE,
error = FALSE,
fig.width = 12,
fig.height = 8,
dpi = 300
)
# Load data from dataset_2867obs.rds
data <- readRDS('dataset_2867obs.rds')
# Data summary
cat('Dataset loaded:', nrow(data), 'rows,', ncol(data), 'columns\n')
```
## {{< iconify ph chart-bar >}} This is a standalone chart.
This standalone chart shows the overall distribution of happiness across education levels.
```{r stackedbar-degree-1a-happy-1a}
# This is a standalone chart.
result <- create_stackedbar(
data = data,
title = "This is a standalone chart.",
x_var = "degree_1a",
stack_var = "happy_1a",
subtitle = "Here you'll notice that this is a standalone plot.",
x_label = "Education Level",
y_label = "Percentage of Respondents",
stack_label = "Happiness Level",
stacked_type = "percent",
x_order = c("Lt High School", "High School", "Junior College", "Bachelor", "Graduate"),
stack_order = c("Very Happy", "Pretty Happy", "Not Too Happy"),
tooltip_suffix = "%",
color_palette = c("#2E86AB", "#A23B72", "#F18F01")
)
# Apply height to highcharter object
if (inherits(result, 'highchart')) {
result <- highcharter::hc_chart(result, height = 600)
}
result
```
## {{< iconify ph shield-check >}} Here's another summary chart
```{r heatmap-partyid-1a-polviews-1a}
# Here's another summary chart
result <- create_heatmap(
data = data,
title = "Here's another summary chart",
x_var = "partyid_1a",
y_var = "polviews_1a",
value_var = "trust_1a",
subtitle = "This summary chart visualizes trust patterns across political groups",
x_label = "Party Identification",
y_label = "Political Views",
value_label = "Trust Level",
x_order = c("Strong Democrat", "Not Very Strong Democrat", "Independent, Close to Democrat", "Independent", "Independent, Close to Republican", "Not Very Strong Republican", "Strong Republican"),
y_order = c("Extremely Liberal", "Liberal", "Slightly Liberal", "Moderate", "Slightly Conservative", "Conservative", "Extremely Conservative"),
color_palette = c("#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"),
tooltip_prefix = "Trust: ",
tooltip_suffix = "/3",
tooltip_labels_format = "{point.value:.2f}"
)
# Apply height to highcharter object
if (inherits(result, 'highchart')) {
result <- highcharter::hc_chart(result, height = 700)
}
result
```
Subtitle for your standalone chart.