Overview
Kuva provides three annotation types for adding context to plots:TextAnnotation- Text labels with optional arrowsReferenceLine- Horizontal or vertical reference linesShadedRegion- Rectangular shaded areas
TextAnnotation
Text labels with optional arrows pointing to data points.Constructor
Text content
X coordinate in data space
Y coordinate in data space
Methods
with_arrow
Adds an arrow pointing from the text to a target point.
with_color
Sets text and arrow color.
with_font_size
Sets font size (default: 12).
with_arrow_padding
Sets padding between arrow tip and target point (default: 6.0).
Usage
ReferenceLine
Horizontal or vertical reference lines with optional labels.Constructors
ReferenceLine::horizontal
Creates a horizontal line at the specified y-value.
ReferenceLine::vertical
Creates a vertical line at the specified x-value.
Methods
with_color
Sets line color (default: “red”).
with_label
Adds a label to the line.
with_stroke_width
Sets line width (default: 1.0).
with_dasharray
Sets dash pattern (default: “6 4”).
Usage
ShadedRegion
Rectangular shaded areas for highlighting ranges.Constructors
ShadedRegion::horizontal
Shades between two y-values (spans full x-axis width).
ShadedRegion::vertical
Shades between two x-values (spans full y-axis height).
Methods
with_color
Sets fill color (default: “blue”).
with_opacity
Sets fill opacity (default: 0.15).
Usage
Combining Annotations
Multiple annotations can be added to a single layout:Source
src/render/annotations.rs