Documentation
¶
Overview ¶
Package svgkit renders brand-agnostic, parametric SVG components (gauge, comparison-bar, chromatogram, icon) from JSON specs. Pure, deterministic, and dependency-free: every color/datum is caller-supplied (no brand tokens), and a given spec always yields byte-identical SVG. Used by the harness's generate_svg task for crisp, free, on-demand data-viz.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BarItem ¶
type BarItem struct {
Label string `json:"label"`
Value float64 `json:"value"`
Color string `json:"color,omitempty"`
}
BarItem is one row in a comparison-bar chart.
type ChromatogramSpec ¶
type ChromatogramSpec struct {
Peaks []Peak `json:"peaks"`
XMax float64 `json:"x_max,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
XLabel string `json:"x_label,omitempty"`
YLabel string `json:"y_label,omitempty"`
Theme Theme `json:"theme,omitempty"`
}
ChromatogramSpec describes an HPLC-style trace.
type ComparisonBarSpec ¶
type ComparisonBarSpec struct {
Items []BarItem `json:"items"`
Max float64 `json:"max,omitempty"`
Width int `json:"width,omitempty"`
BarHeight int `json:"bar_height,omitempty"`
Unit string `json:"unit,omitempty"`
Highlight int `json:"highlight,omitempty"`
Theme Theme `json:"theme,omitempty"`
}
ComparisonBarSpec describes a horizontal bar chart. Highlight is the index of the item to emphasize (use a negative value, e.g. -1, for none).
type GaugeSpec ¶
type GaugeSpec struct {
Value float64 `json:"value"`
Min float64 `json:"min,omitempty"`
Max float64 `json:"max,omitempty"`
Label string `json:"label,omitempty"`
Unit string `json:"unit,omitempty"`
Size int `json:"size,omitempty"`
Zones []GaugeZone `json:"zones,omitempty"`
Theme Theme `json:"theme,omitempty"`
}
GaugeSpec describes a 270° radial dial, open at the bottom.
type IconSpec ¶
type IconSpec struct {
Name string `json:"name"`
Size int `json:"size,omitempty"`
Color string `json:"color,omitempty"`
Stroke float64 `json:"stroke,omitempty"`
Theme Theme `json:"theme,omitempty"`
}
IconSpec describes a stroke-based icon in a 24×24 viewBox scaled to Size.
type Peak ¶
type Peak struct {
RT float64 `json:"rt"`
Height float64 `json:"height"`
Width float64 `json:"width,omitempty"`
Label string `json:"label,omitempty"`
}
Peak is one Gaussian peak in a chromatogram trace.
type Theme ¶
type Theme struct {
FG string `json:"fg,omitempty"`
BG string `json:"bg,omitempty"`
Accent string `json:"accent,omitempty"`
Muted string `json:"muted,omitempty"`
Font string `json:"font,omitempty"`
}
Theme is the brand-agnostic palette + type for a component. Empty fields fall back to a neutral slate default (NO brand tokens).