Below is an example using a simple custom layout. Custom layouts are implemented using a CSV-style string. This example uses a basic North-East-South-West grid. A custom layout will also require accompanying custom labels.
library(rsquaire)
# Create some data about each cardinal direction
custom_data <-
tibble::tribble(
~state, ~Direction, ~`Fun Fact`, ~Note,
"N", "Longitude", "Compasses are attracted to me", "AKA Polaris!!",
"E", "Latitude", "The Sun rises here...mostly", "",
"S", "Longitude", "Penguins on penguins on penguins", "",
"W", "Latitude", "Where the Sun goes to bed", ""
)
# Create accompanying custom labels, full and short are required
custom_labels <-
list(
N = list(full = "North", short = "N"),
E = list(full = "East", short = "E"),
S = list(full = "South", short = "S"),
W = list(full = "West", short = "W")
)
# These are the categories for my string index, they'll be assigned colors in order
custom_cats <- c("Longitude", "Latitude")
custom_colors <- c("#c9e2f5","#c6e2ba")
custom_layout <- ",N,\nW,,E\n,S,"
rsquaire(custom_data,
index = "Direction",
indexType = "string",
categories = custom_cats,
layout = custom_layout,
labels = custom_labels,
colors = custom_colors,
labelStyle = "full",
whitelist = c("Direction", "Fun Fact"),
noteIndex = "Note",
tooltip = TRUE,
mode = "static",
width = "500px",
height = "500px")