glass_fill | R Documentation |
This function generates an SVG visualization of a glass filled with water to a specified level, rendered via D3 using the r2d3 package. The fill level, appearance of the glass, and label settings can be customized.
glass_fill(
fill_level = 0.65,
glassWidth = 80,
glassHeight = 200,
strokeColor = "#555",
strokeWidth = 3,
fillColor = "skyblue",
renderFillLabel = TRUE,
labelFontSize = "16px",
titleText = "Fill level",
labelColor = "#333",
titleColor = "#333",
titleFontSize = "14px",
font = "Verdana, Geneva, Tahoma, sans-serif"
)
fill_level |
Numeric value between 0 and 1 indicating how full the glass should appear. |
glassWidth |
Width of the glass in pixels. |
glassHeight |
Height of the glass in pixels. |
strokeColor |
Color of the glass outline (stroke). |
strokeWidth |
Width of the glass outline stroke. |
fillColor |
Color used to fill the water in the glass. |
renderFillLabel |
Logical indicating whether to display a percentage label above the glass. |
labelFontSize |
Font size of the label, defaults to "16px" |
titleText |
Text to display as the title beneath the glass. |
labelColor |
Color of the label. |
titleColor |
Color of the title text displayed below the glass. |
titleFontSize |
Font size of the title text, defaults to "14px" |
font |
The font name that will be used for the plot text. Defaults to "Verdana, Geneva, Tahoma, sans-serif" |
An interactive D3 visualization rendered in the RStudio Viewer or web browser.
glass_fill(fill_level = 0.75)
glass_fill(fill_level = 0.3, fillColor = "lightblue", titleText = "Water Intake")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.