Annotation types
Graphy supports seven types of annotations.Sticker
Adds an emoji sticker to a specific data point on the chart.Annotation type identifier.
The sticker to display. Available options:
'rocket', 'clapping-hands', 'thumbs-up', 'thumbs-down', 'grinning-face'.Zero-based index of the row this annotation targets.
Key of the column this annotation targets.
Optional categorical value to pin the annotation to. Used to remap the annotation if the dataset changes.
Tooltip
Displays a custom tooltip with rich text content at a specific data point.Annotation type identifier.
Rich text (TipTap JSON) shown inside the tooltip.
Zero-based index of the row this annotation targets.
Key of the column this annotation targets.
Optional categorical value to pin the annotation to.
Highlight
Highlights a data point, entire series or all data points at a specific x-value.Annotation type identifier.
What to highlight:
'data-point'- Highlight a single data point'series'- Highlight an entire series'x-value'- Highlight all data points at a specific x-value
Zero-based index of the row this annotation targets.
Key of the column this annotation targets.
Optional categorical value to pin the annotation to.
Text
Adds a text box with rich text content positioned relative to the plot area.Annotation type identifier.
Rich text content (TipTap JSON).
Horizontal position relative to the plot area (0 to 1). Represents the midpoint of the text box.
Vertical position relative to the plot area (0 to 1). Represents the midpoint of the text box.
Width relative to the plot area (0 to 1).
Background color for the text box (hex color).
Background style:
'fade' for semi-transparent or 'opaque' for solid.Arrow
Draws an arrow between two points on the chart with customizable styling.Annotation type identifier.
Starting horizontal position relative to the plot area (0 to 1).
Starting vertical position relative to the plot area (0 to 1).
Ending horizontal position relative to the plot area (0 to 1).
Ending vertical position relative to the plot area (0 to 1).
Arrow color (hex color or null for default).
Arrow line thickness.
Arrowhead style at the start of the line.
Line style.
Arrowhead style at the end of the line.
Whether to use a sticker outline style for the arrow.
Difference arrow
Shows the difference between two data points with an automatic label displaying the calculated difference.Annotation type identifier.
What to display:
'absolute-difference'- Show the numeric difference'relative-difference'- Show the percentage change'proportion'- Show the ratio between values
Starting data point for the difference calculation.
Ending data point for the difference calculation. Same structure as
start.Arrow color (hex color or null for default).
Arrow size.
Position of the label along the arrow (0 to 1):
0- Label at the start (default)0.5- Label in the middle1- Label at the end
Shape
Adds a rectangular shape to the chart, either below or above the plot area.Annotation type identifier.
Shape type. Currently only rectangles are supported.
Whether to render the shape below or above the plot area.
Horizontal position relative to the plot area (0 to 1).
Vertical position relative to the plot area (0 to 1).
Width relative to the plot area (0 to 1).
Height relative to the plot area (0 to 1).
Fill color for the shape (hex color).
Fill opacity (0 to 1).
Border stroke width in pixels.
Canvas colors
Canvas colors are the default options displayed in the color picker for annotations that allow the user to customize strokes, fills and text colors. Each canvas color is defined as an object with the following properties:| Property | Type | Description |
|---|---|---|
id | string | A unique identifier for the color |
label | string (optional) | A human-readable name for the color |
value | string | The hex color value |
Color persistence across themes
Theid property is important for maintaining color consistency when switching between themes. When a user applies a canvas color to an annotation (such as text color or arrow stroke), the color’s id is stored rather than the hex value itself.
When the theme changes:
- Matching ID found: If the new theme contains a canvas color with the same
id, the annotation automatically uses the color value from the new theme. This allows colors to adapt appropriately—for example, a “default” color might be black in a light theme but white in a dark theme. - No matching ID: If the new theme does not contain a canvas color with the same
id, the annotation falls back to the first canvas color in the new theme’scanvasColorsarray.
Default annotation colors
When users create new annotations, Graphy applies default colors automatically. You can configure these defaults via thedefaultAnnotationColorIds property in your theme, which references the id values from your canvasColors array.
See GraphThemeAnnotationColorIds for the available properties.
Fallback behavior
If a default annotation color is not configured or references an invalidid, Graphy automatically falls back to the first canvas color in the canvasColors array. This ensures annotations always render with a valid color, even if the configuration is incomplete.