Overview
GraphConfig is the main configuration object for creating and customising graphs in the Graphy SDK. It combines data, visual styling, text content and interactive features into a single, strongly-typed configuration.
Schema structure
Required properties
Data to visualise. Contains columns and rows.See data structure for detailed documentation.
Optional properties
Graph type to render. Defaults to
'column' if not specified.See graph types for all available types.Chart type-specific options (line thickness, smooth lines, bar sorting, etc.).See type options for details.
Axis configuration for x, y and secondary y axes.See axes configuration for details.
Legend position and visibility.See legend configuration for details.
Visual styling including colors, borders, backgrounds, text styles and number formatting.See appearance configuration for details.
Theme-level customization. Overrides specific theme values like
graphBackground, textColor, etc.See GraphTheme schema for available properties.Text content for title, subtitle, caption and data source.See content configuration for details.
Summary metrics displayed prominently on the chart.See headline numbers for details.
Configuration for value labels displayed on chart elements.See data labels for details.
Visual annotations layered on top of the chart (stickers, tooltips, highlights, text, arrows, shapes).See annotations for details.
Goal lines, trendlines and average lines.See reference lines for details.
Internal metadata. This is managed automatically and should not be set manually.
Complete example
Type definitions
TheGraphConfig type is defined using Zod for runtime validation:
Using with GraphProvider
Pass your config toGraphProvider:
Validation
The GraphConfig schema includes runtime validation via Zod. Invalid configurations will throw validation errors with helpful messages:Migration from old schema
If you’re migrating from the old schema, the main differences are:| Old schema | New schema |
|---|---|
data: RawData[] | data: { columns: Column[], rows: Row[] } |
datasetConfig | Merged into data.columns |
visualizationConfig | Split into type and options |
customAppearanceConfig | Renamed to appearance |
titleDocument, caption | Moved to content.title, content.caption |
sourceLabel, sourceUrl | Moved to content.source |