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"
)

Arguments

fill_level

Numeric value between 0 and 1 indicating how full the glass should appear (e.g., 0.65 = 65

glassWidthWidth of the glass in pixels.

glassHeightHeight of the glass in pixels.

strokeColorColor of the glass outline (stroke).

strokeWidthWidth of the glass outline stroke.

fillColorColor used to fill the water in the glass.

renderFillLabelLogical indicating whether to display a percentage label above the glass.

labelFontSizeFont size of the label, defaults to "16px"

titleTextText to display as the title beneath the glass.

labelColorColor of the label.

titleColorColor of the title text displayed below the glass.

titleFontSizeFont size of the title text, defaults to "14px"

An interactive D3 visualization rendered in the RStudio Viewer or web browser. 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.75) glass_fill(fill_level = 0.3, fillColor = "lightblue", titleText = "Water Intake")