Charts (iOS)
Use charts in Live Activities and widgets to show trends, comparisons, progress, or composition at a glance. You can mix bars, lines, areas, points, rules, and sectors in a single chart.
Charts require iOS 16.0+. SectorMark (pie/donut) requires iOS 17.0+.
Mark components (BarMark, LineMark, etc.) must be direct children of <Voltra.Chart>. They cannot be wrapped in custom components. For example, this will not work:
Instead, always place marks directly inside Chart:
Basic Usage
Wrap one or more mark components inside <Voltra.Chart>:
Data Types
All marks except RuleMark take a data prop. There are two data shapes depending on the mark type:
Marks
BarMark
Use bars when people need to compare values across categories.
Parameters:
data(ChartDataPoint[], required): The data points.color(string, optional): Fill color.cornerRadius(number, optional): Rounded bar corners.width(number, optional): Fixed bar width.stacking(string, optional):"grouped"(side by side).
LineMark
Use a line when the shape of change matters more than individual columns.
Parameters:
data(ChartDataPoint[], required): The data points.color(string, optional): Line color.lineWidth(number, optional): Stroke width in points.interpolation(string, optional): Curve type —"linear","monotone","catmullRom","cardinal","stepStart","stepCenter", or"stepEnd".symbol(string, optional): Symbol at each point —"circle","square","triangle","diamond","pentagon","cross","plus", or"asterisk".
AreaMark
Use an area chart when you want the overall volume or rise/fall pattern to read quickly.
Parameters:
data(ChartDataPoint[], required): The data points.color(string, optional): Fill color.interpolation(string, optional): Same options as LineMark.
PointMark
Use points for sparse measurements, scatter plots, or to emphasize exact observations.
Parameters:
data(ChartDataPoint[], required): The data points.color(string, optional): Point color.symbol(string, optional): Same options as LineMark.symbolSize(number, optional): Symbol size in points.
RuleMark
A horizontal or vertical reference line. Unlike other marks, RuleMark has no data array.
Parameters:
yValue(number, optional): Draw a horizontal line at this y value.xValue(string | number, optional): Draw a vertical line at this x value.color(string, optional): Line color.lineWidth(number, optional): Stroke width in points.
If both xValue and yValue are provided, Voltra renders both lines.
SectorMark
Pie and donut charts. Requires iOS 17+.
Parameters:
data(SectorDataPoint[], required): Sector data withvalueandcategory.color(string, optional): Fill color (overrides automatic coloring).innerRadius(number, optional): Ratio from 0 to 1.0= pie chart, any value above0= donut chart.outerRadius(number, optional): Ratio from 0 to 1.angularInset(number, optional): Gap between sectors in degrees.
Chart Props
The <Voltra.Chart> container accepts these props in addition to the standard Voltra style prop:
Grid Lines
Use xAxisGridStyle and yAxisGridStyle when the default grid is too busy or not visible enough for your design:
Multi-Series Charts
Add a series field to your data points when you want multiple datasets in the same chart. Use foregroundStyleScale to keep those series colors consistent:
Without foregroundStyleScale, colors are chosen automatically.
For side-by-side bars, set stacking="grouped":
Combining Marks
Mix mark types when one chart needs both context and emphasis, such as bars for totals plus a rule for a target:
Sparkline / Minimal Style
Hide axes and legend for a clean, compact visualization:
Widget / Live Activity Notes
Charts in widgets and Live Activities are static. Focus on a clear snapshot of the data rather than interactions like panning or scrolling.
The <Voltra.Chart> component supports the full Voltra style system on its container — padding, background, borders, corner radius, shadows, and sizing all work:
