suiss/ui · Component
Chart
Themed building blocks for Recharts charts, with a shared color config, tooltip and legend.
Chart is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Chart does not draw charts itself; it styles charts you compose with recharts. A ChartContainer takes a config that maps each data key to a label, an optional icon and a color, and wraps your Recharts chart in a ResponsiveContainer. Inside the chart, use ChartTooltip with content={<ChartTooltipContent />} and ChartLegend with content={<ChartLegendContent />} to render a tooltip and legend that read labels and colors from the config.
Use it for bar, line, area and pie charts in dashboards and reports. Because you work with Recharts directly, every Recharts chart type and prop remains available.
For ready-made charts built on it, see the area, bar, line, pie, radar and radial charts, and the tooltip variants.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
- Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Examples
Multiple series
Two bar series with a ChartLegend and a tooltip that sets indicator="dashed".
Stacked
Stacks two bar series and sets hideLabel on ChartTooltipContent to hide the tooltip label.
Line series
Two smooth lines with a tooltip that sets indicator="line".
Area series
Two stacked, semi-transparent areas.
Donut
A pie chart with an inner radius. Each row is its own category, so the color is in the row (for example fill: "var(--color-safari)") and nameKey on ChartLegendContent looks labels up by that field. The container uses aspect-square max-w-72.
Accessibility
- Enable
accessibilityLayeron the Recharts chart to support keyboard navigation. The chart is then focusable and arrow keys move between data points, showing the tooltip for each. ChartContainergives the chart anaria-label: yours, or "Chart of" followed by the config labels. A chart element that already has anaria-labelkeeps it.- Charts are visual; provide a nearby summary or table when the exact values matter.
- Do not rely on color alone to tell series apart; the legend and tooltip pair each color with its label.
API Reference
ChartContainer
Provides the config, injects the color variables and makes the chart responsive.
| Prop | Type | Default |
|---|---|---|
config | ChartConfig | Required |
children | React.ReactNode | Required |
initialDimension | { width: number; height: number } | { width: 320, height: 200 } |
aria-label | string | "Chart of <series labels>" |
Also accepts the props of React.ComponentProps<"div">.
config maps each data key to a label, an optional icon, and a color or per-theme theme colors. Each key becomes a CSS custom property scoped to the chart, such as --color-desktop; reference it from your series, as in fill="var(--color-desktop)". Set color for a single value, or theme with light and dark values to switch colors with the .dark class. Config keys and color values containing unsafe characters are skipped when generating CSS.
Pass the Recharts chart as children. initialDimension is the width and height used before the container is measured. Without an aria-label, the chart gets "Chart of" followed by the config labels, or "Chart" when there are none. The container is aspect-video by default; override its size with className, for example aspect-square max-w-72. It restyles Recharts defaults, such as grid lines, axis ticks and the tooltip cursor. It sets data-slot="chart" and a unique data-chart id that scopes the generated --color-* variables.
ChartTooltip, ChartLegend and ChartStyle are also exported; the first two are the Recharts Tooltip and Legend components.
ChartTooltipContent
A styled tooltip body that lists each series with its indicator, label and value.
| Prop | Type | Default |
|---|---|---|
hideLabel | boolean | false |
hideIndicator | boolean | false |
indicator | "line" | "dot" | "dashed" | "dot" |
nameKey | string | - |
labelKey | string | - |
Also accepts the props of the Recharts Tooltip and React.ComponentProps<"div">.
Render it with <ChartTooltip content={<ChartTooltipContent />} />. nameKey is the field used to look up each item's config entry instead of its name or data key, and labelKey the field used to look up the heading label. Number values are formatted with toLocaleString().
ChartLegendContent
A styled legend that lists series in config order with a swatch or icon.
| Prop | Type | Default |
|---|---|---|
hideIcon | boolean | false |
nameKey | string | - |
Also accepts the props of React.ComponentProps<"div"> and the Recharts DefaultLegendContentProps.
Render it with <ChartLegend content={<ChartLegendContent />} />. hideIcon shows a color swatch even when the config entry has an icon. nameKey is the field used to look up each legend item's config entry instead of its data key.
Web preview
Charts are composed declaratively: a chart root such as LineChart, AreaChart, BarChart, ComposedChart, PieChart, RadialBarChart or RadarChart goes inside a ChartContainer, and series and axes such as Line, Area, Bar, XAxis, YAxis and CartesianGrid are added as children. These child components render nothing themselves; the root reads them and draws everything with react-native-svg.
Charts animate in when they first render: bars grow from the baseline, lines draw along their path, areas reveal from left to right, pie and radial sectors sweep open and radar shapes grow from the center. When the data changes, shapes animate from their previous values to the new ones.
Colors are theme tokens, not hex values. A series color such as chart-1, chart-2 or primary resolves to the current token color, so charts follow light and dark mode automatically.
For ready-made charts built on it, see the area, bar, line, pie, radar and radial charts.
Installation
- Install the following dependencies:
- Copy and paste the following code into
components/ui/chart.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
- Copy and paste the following code into
components/ui/chart.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
- Copy and paste the following code into
components/ui/chart.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Tooltip line
Set indicator to line on the tooltip content.

Tooltip dashed
Set indicator to dashed on the tooltip content.

Tooltip no indicator
Hide the indicator to show only names and values.

Tooltip no label
Hide the category label of the tooltip.

Tooltip label formatter
A formatted date as the tooltip label, set with labelFormatter.

Tooltip formatter
Custom value formatting with formatter.

Tooltip icons
Icons from the config in place of color indicators.
Tooltip custom
A fully custom tooltip rendered from a function.

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Tooltip interactive
Settings that change the tooltip on a stacked bar chart with a legend.

Accessibility
- The chart is one accessible element labelled with its series names and data range; pass
accessibilityLabeltoChartContainerto override the names. - With a tooltip it has the
adjustablerole: VoiceOver and TalkBack swipe actions step through data points, and the selected values are announced as the value text. - Without a tooltip it has the
imagerole. - With Reduce Motion on, charts skip the enter and update animations and draw in their final state.
API Reference
ChartPalette
Resolves token colors to concrete values.
| Prop | Type | Default |
|---|---|---|
colors | readonly ChartColor[] | Required |
children | (palette: Partial<Record<ChartColor, string>>) => React.ReactNode | Required |
Pass the token colors to resolve, and a function as children that receives the resolved colors for custom drawing. useChart() returns the config inside a container.
ChartContainer
Sizes the chart and provides the config.
| Prop | Type | Default |
|---|---|---|
config | ChartConfig | Required |
Also accepts the props of ChartPrimitive.ContainerProps.
Describe each series in a ChartConfig object with a label, a token color and an optional icon, keyed by data key. Series colors accept chart-1 to chart-5, theme colors such as primary, destructive and foreground, and palette colors such as green-500 and red-500. The container is full width with a 16:9 aspect ratio unless you give it an h-, size- or aspect- class.
Line, Area, Bar, Pie, RadialBar and Radar take isAnimationActive, animationDuration and animationEasing. Bars default to 400 ms and curves, sectors and radar shapes to 1500 ms, with ease easing. Set isAnimationActive={false} to draw a series in its final state, for example when its data changes on every interaction. Value labels from LabelList and pie label appear once a series finishes animating.
LineChart
Cartesian chart for Line series.
Takes data, margin, onActiveIndexChange and children from ChartPrimitive.RootProps.
AreaChart
Cartesian chart for Area series, with optional stacking.
Takes data, margin, stackOffset, onActiveIndexChange and children from ChartPrimitive.RootProps.
BarChart
Cartesian chart for Bar series, vertical or horizontal.
Takes data, margin, layout, barGap, barCategoryGap, onActiveIndexChange and children from ChartPrimitive.RootProps.
ComposedChart
Cartesian chart that mixes lines, areas and bars.
Takes data, margin, onActiveIndexChange and children from ChartPrimitive.RootProps.
PieChart
Pie and donut charts built from Pie.
Takes margin, onActiveIndexChange and children from ChartPrimitive.RootProps.
RadialBarChart
Circular bars built from RadialBar.
Takes data, margin, innerRadius, outerRadius, startAngle, endAngle, barSize, cx, cy, onActiveIndexChange and children from ChartPrimitive.RootProps.
RadarChart
Polar chart built from Radar and PolarGrid.
Takes data, margin, outerRadius, cy, onActiveIndexChange and children from ChartPrimitive.RootProps.
ChartTooltipContent
Default tooltip card.
| Prop | Type | Default |
|---|---|---|
className | string | - |
indicator | "line" | "dot" | "dashed" | "dot" |
hideLabel | boolean | false |
hideIndicator | boolean | false |
nameKey | string | - |
labelFormatter | ( label: React.ReactNode, payload: ChartPrimitive.TooltipItem[] ) => React.ReactNode | - |
formatter | ( value: ChartPrimitive.ChartValue, name: string, item: ChartPrimitive.TooltipItem, index: number, payload: ChartPrimitive.ChartDatum ) => React.ReactNode | - |
Add ChartTooltip with content={<ChartTooltipContent />} to make the chart respond to touch: touching or dragging selects the nearest data point, draws a cursor and shows the tooltip, with a selection haptic. Use defaultIndex on ChartTooltip to start with a point selected, or onActiveIndexChange on the chart to react to selection. labelFormatter formats the label, formatter renders each row yourself, and nameKey is the data key used to look up series names in the config.
ChartLegendContent
Default legend with swatches or icons.
| Prop | Type | Default |
|---|---|---|
className | string | - |
nameKey | string | - |
Add ChartLegend with content={<ChartLegendContent />} for a legend in config order. nameKey is the data key used to look up legend names in the config.
ChartConfig
| Parameter | Type | Default |
|---|---|---|
_ elements | [(String, Item)] | - |
dictionaryLiteral | (String, Item)... | - |
Overloads: init(_:), init(dictionaryLiteral:).
| Property | Type |
|---|---|
keys | [String] |
ChartConfig.label
| Parameter | Type | Default |
|---|---|---|
_ key | String | - |
Returns String.
ChartConfig.color
| Parameter | Type | Default |
|---|---|---|
_ key | String | - |
Returns Color.
ChartContainer
Sizes the chart and provides the config.
| Parameter | Type | Default |
|---|---|---|
config | ChartConfig | - |
content | () -> Content | - |
ChartAnimationEasing
Values: .ease, .easeIn, .easeOut, .easeInOut, .linear.
ChartAnimator
| Parameter | Type | Default |
|---|---|---|
isAnimationActive | Bool | true |
animationDuration | Double | 1500 |
animationEasing | ChartAnimationEasing: .ease | .easeIn | .easeOut | .easeInOut | .linear | .ease |
content | (Double) -> Content | - |
ChartAnchorMark
| Parameter | Type | Default |
|---|---|---|
x | PlottableValue<X> | - |
y | PlottableValue<Y> | - |
ChartSectorRest
| Parameter | Type | Default |
|---|---|---|
total | Double | - |
progress | Double | - |
ChartTooltipItem
| Parameter | Type | Default |
|---|---|---|
_ key | String | - |
value | Double | - |
color | Color? | nil |
| Property | Type |
|---|---|
key | String |
value | Double |
color | Color? |
id | String |
ChartTooltipPayload
| Parameter | Type | Default |
|---|---|---|
index | Int | - |
label | String | - |
items | [ChartTooltipItem] | - |
| Property | Type |
|---|---|
index | Int |
label | String |
items | [ChartTooltipItem] |
total | Double |
ChartTooltipIndicator
Values: .dot, .line, .dashed.
ChartTooltipContent
Default tooltip card.
| Parameter | Type | Default |
|---|---|---|
_ payload | ChartTooltipPayload | - |
indicator | ChartTooltipIndicator: .dot | .line | .dashed | .dot |
hideLabel | Bool | false |
hideIndicator | Bool | false |
labelFormatter | (ChartTooltipPayload) -> LabelContent | - |
formatter | (ChartTooltipItem) -> ValueContent | - |
Overloads: init(_:indicator:hideLabel:hideIndicator:labelFormatter:formatter:), init(_:indicator:hideLabel:hideIndicator:formatter:), init(_:indicator:hideLabel:hideIndicator:labelFormatter:), init(_:indicator:hideLabel:hideIndicator:).
ChartLegendContent
Default legend with swatches or icons.
| Parameter | Type | Default |
|---|---|---|
keys | [String]? | nil |
hideIcon | Bool | false |
.chartTooltip
| Parameter | Type | Default |
|---|---|---|
x | [Value] | - |
labels | [String]? | nil |
selection | Binding<Int?>? | nil |
defaultIndex | Int? | nil |
cursor | Bool | true |
sticky | Bool | true |
accessibilityLabel | String? | nil |
items | (Int) -> [ChartTooltipItem] | - |
content | (ChartTooltipPayload) -> Tooltip | - |
y | [Value] | - |
angle | [Double] | - |
startAngle | Angle | .zero |
endAngle | Angle | .degrees(360) |
innerRadius | CGFloat | 0 |
outerRadius | CGFloat | 1 |
Overloads: chartTooltip(x:labels:selection:defaultIndex:cursor:sticky:accessibilityLabel:items:content:), chartTooltip(y:labels:selection:defaultIndex:sticky:accessibilityLabel:items:content:), chartTooltip(angle:labels:startAngle:endAngle:innerRadius:outerRadius:selection:defaultIndex:sticky:accessibilityLabel:items:content:).
RadialBar
| Parameter | Type | Default |
|---|---|---|
_ key | String | - |
value | Double | - |
color | Color? | nil |
| Property | Type |
|---|---|
key | String |
value | Double |
color | Color? |
id | String |
RadialBarTrack
Values: .none, .control, .tint.
RadialBarChart
Circular bars built from RadialBar.
| Parameter | Type | Default |
|---|---|---|
_ bars | [RadialBar] | - |
domain | ClosedRange<Double>? | nil |
innerRadius | CGFloat | 0 |
outerRadius | CGFloat | 0.8 |
barSize | CGFloat? | nil |
startAngle | Angle | .degrees(90) |
endAngle | Angle | .degrees(-270) |
rounded | Bool | false |
track | RadialBarTrack: .none | .control | .tint | .none |
showsLabels | Bool | false |
selection | Binding<Int?>? | nil |
defaultIndex | Int? | nil |
sticky | Bool | true |
accessibilityLabel | String? | nil |
isAnimationActive | Bool | true |
animationDuration | Double | 1500 |
animationEasing | ChartAnimationEasing: .ease | .easeIn | .easeOut | .easeInOut | .linear | .ease |
tooltip | (ChartTooltipPayload) -> Tooltip | - |
Overloads: init(_:domain:innerRadius:outerRadius:barSize:startAngle:endAngle:rounded:track:showsLabels:selection:defaultIndex:sticky:accessibilityLabel:isAnimationActive:animationDuration:animationEasing:tooltip:), init(_:domain:innerRadius:outerRadius:barSize:startAngle:endAngle:rounded:track:isAnimationActive:animationDuration:animationEasing:).
PolarGridType
Values: .polygon, .circle.
PolarGrid
| Parameter | Type | Default |
|---|---|---|
gridType | PolarGridType: .polygon | .circle | .polygon |
stroke | Color | EsuissColor.border |
strokeWidth | CGFloat | 1 |
fill | Color? | nil |
fillOpacity | Double | 1 |
| Property | Type |
|---|---|
gridType | PolarGridType |
stroke | Color |
strokeWidth | CGFloat |
fill | Color? |
fillOpacity | Double |
PolarAngleAxis
| Parameter | Type | Default |
|---|---|---|
textStyle | TextStyle | .xs |
highlightsSelection | Bool | false |
| Property | Type |
|---|---|
textStyle | TextStyle |
highlightsSelection | Bool |
PolarRadiusAxis
| Parameter | Type | Default |
|---|---|---|
angle | Angle | - |
tickCount | Int | 5 |
| Property | Type |
|---|---|
angle | Angle |
tickCount | Int |
Radar
| Parameter | Type | Default |
|---|---|---|
_ key | String | - |
values | [Double] | - |
color | Color? | nil |
fillOpacity | Double | 0.3 |
strokeWidth | CGFloat | 2 |
strokeOpacity | Double | 1 |
dot | CGFloat? | nil |
| Property | Type |
|---|---|
key | String |
values | [Double] |
color | Color? |
fillOpacity | Double |
strokeWidth | CGFloat |
strokeOpacity | Double |
dot | CGFloat? |
id | String |
RadarChart
Polar chart built from Radar and PolarGrid.
| Parameter | Type | Default |
|---|---|---|
_ series | [Radar] | - |
labels | [String] | - |
domain | ClosedRange<Double>? | nil |
outerRadius | CGFloat | 0.8 |
center | UnitPoint | .center |
margin | EdgeInsets | EdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5) |
grid | PolarGrid? | PolarGrid() |
angleAxis | PolarAngleAxis | PolarAngleAxis() |
radiusAxis | PolarRadiusAxis? | nil |
selection | Binding<Int?>? | nil |
defaultIndex | Int? | nil |
sticky | Bool | true |
accessibilityLabel | String? | nil |
items | ((Int) -> [ChartTooltipItem])? | nil |
isAnimationActive | Bool | true |
animationDuration | Double | 1500 |
animationEasing | ChartAnimationEasing: .ease | .easeIn | .easeOut | .easeInOut | .linear | .ease |
tooltip | (ChartTooltipPayload) -> Tooltip | - |
ChartConfigItem
| Parameter | Type | Default |
|---|---|---|
label | String? | null |
icon | ImageVector? | null |
color | (Colors.() -> Color)? | null |
ChartConfig
| Parameter | Type | Default |
|---|---|---|
items | vararg Pair<String, ChartConfigItem> | - |
| Property | Type |
|---|---|
keys | List<String> get() |
ChartConfig.get
| Parameter | Type | Default |
|---|---|---|
key | String | - |
Returns ChartConfigItem?.
ChartContainer
Sizes the chart and provides the config.
| Parameter | Type | Default |
|---|---|---|
config | ChartConfig | - |
modifier | Modifier | Modifier |
content | @Composable BoxScope.() -> Unit | - |
chartColor
| Parameter | Type | Default |
|---|---|---|
key | String | - |
Returns Color.
ChartCurve
Values: Natural, Monotone, Linear, Step.
ChartLayout
Values: Horizontal, Vertical.
ChartStackOffset
Values: None, Expand.
ChartAxisOrientation
Values: Left, Right.
ChartTooltipIndicator
Values: Dot, Line, Dashed.
ChartLabelPosition
Values: Top, InsideStart.
ChartEasing
Values: Ease, EaseIn, EaseOut, EaseInOut, Linear.
ChartMargin
| Parameter | Type | Default |
|---|---|---|
top | Dp | 5.dp |
right | Dp | 5.dp |
bottom | Dp | 5.dp |
left | Dp | 5.dp |
ChartDot
| Parameter | Type | Default |
|---|---|---|
radius | Dp | - |
color | Color? | null |
strokeColor | Color? | null |
strokeWidth | Dp | 0.dp |
ChartRadius
| Parameter | Type | Default |
|---|---|---|
topStart | Dp | - |
topEnd | Dp | - |
bottomEnd | Dp | - |
bottomStart | Dp | - |
ChartCell
| Parameter | Type | Default |
|---|---|---|
color | Color? | null |
alpha | Float | 1f |
ChartCursor
| Parameter | Type | Default |
|---|---|---|
color | Color? | null |
width | Dp | 1.dp |
ChartSector
| Parameter | Type | Default |
|---|---|---|
lift | Dp | 0.dp |
ring | ChartRing? | null |
ChartRing
| Parameter | Type | Default |
|---|---|---|
gap | Dp | - |
width | Dp | - |
ChartLabelList
| Parameter | Type | Default |
|---|---|---|
position | ChartLabelPosition: Top | InsideStart | ChartLabelPosition.Top |
offset | Dp | 5.dp |
color | Color? | null |
fontSize | TextUnit | 12.sp |
formatter | ((index: Int, value: Double) -> String)? | null |
ChartFill
| Value | Parameters |
|---|---|
Solid | color: Color? = null, alpha: Float = 1f |
VerticalGradient | color: Color? = null, topAlpha: Float, bottomAlpha: Float |
HorizontalGradient | stops: List<Pair<Float, Color>> |
ChartTooltipContent
Default tooltip card.
Receiver: ChartTooltipScope.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
indicator | ChartTooltipIndicator: Dot | Line | Dashed | ChartTooltipIndicator.Dot |
hideLabel | Boolean | false |
hideIndicator | Boolean | false |
labelFormatter | (@Composable (label: String, items: List<ChartTooltipItem>) -> Unit)? | null |
formatter | (@Composable RowScope.(item: ChartTooltipItem) -> Unit)? | null |
color | Color? | null |
payload | List<ChartTooltipItem> | items |
ChartLegendContent
Default legend with swatches or icons.
| Parameter | Type | Default |
|---|---|---|
keys | List<String> | - |
modifier | Modifier | Modifier |
hideIcon | Boolean | false |
CartesianChartScope.CartesianGrid
| Parameter | Type | Default |
|---|---|---|
strokeDasharray | List<Float>? | null |
CartesianChartScope.XAxis
| Parameter | Type | Default |
|---|---|---|
label | (T) -> String | - |
hide | Boolean | false |
tickMargin | Dp | 2.dp |
interval | Int? | null |
ticks | List<Int>? | null |
minTickGap | Dp | 5.dp |
tickFormatter | ((String) -> String)? | null |
domain | ClosedFloatingPointRange<Double>? | null |
Overloads: XAxis(label, hide, tickMargin, interval, ticks, minTickGap, tickFormatter), XAxis(domain).
CartesianChartScope.YAxis
| Parameter | Type | Default |
|---|---|---|
orientation | ChartAxisOrientation: Left | Right | ChartAxisOrientation.Left |
hide | Boolean | false |
tickMargin | Dp | 2.dp |
width | Dp? | null |
domain | ClosedFloatingPointRange<Double>? | null |
ticks | List<Double>? | null |
tickCount | Int | 5 |
tickFormatter | ((Double) -> String)? | null |
label | (T) -> String | - |
tickStyle | TextStyle? | null |
Overloads: YAxis(hide, domain, ticks, tickCount), YAxis(label, tickStyle).
CartesianChartScope.Line
| Parameter | Type | Default |
|---|---|---|
dataKey | String | - |
value | (T) -> Double? | - |
curve | ChartCurve: Natural | Monotone | Linear | Step | ChartCurve.Linear |
stroke | Color? | null |
strokeWidth | Dp | 1.dp |
strokeDasharray | List<Float>? | null |
dot | ChartDot? | null |
dotColor | ((T) -> Color)? | null |
activeDot | ChartDot? | ChartDot(4.dp) |
labelList | ChartLabelList? | null |
isAnimationActive | Boolean | true |
animationDuration | Int | 1500 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
CartesianChartScope.Area
| Parameter | Type | Default |
|---|---|---|
dataKey | String | - |
value | (T) -> Double? | - |
base | ((T) -> Double)? | null |
curve | ChartCurve: Natural | Monotone | Linear | Step | ChartCurve.Linear |
stroke | Color? | null |
strokeWidth | Dp | 1.dp |
fill | ChartFill | ChartFill.Solid(alpha = 0.6f) |
stackId | String? | null |
dot | ChartDot? | null |
activeDot | ChartDot? | ChartDot(4.dp) |
isAnimationActive | Boolean | true |
animationDuration | Int | 1500 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
CartesianChartScope.Bar
| Parameter | Type | Default |
|---|---|---|
dataKey | String | - |
value | (T) -> Double? | - |
base | ((T) -> Double)? | null |
fill | ChartFill | ChartFill.Solid() |
radius | ChartRadius | ChartRadius(0.dp) |
barSize | Dp? | null |
maxBarSize | Dp? | null |
stackId | String? | null |
nameKey | ((T) -> String)? | null |
cells | ((Int) -> ChartCell)? | null |
background | Color? | null |
labelList | ChartLabelList? | null |
isAnimationActive | Boolean | true |
animationDuration | Int | 400 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
CartesianChartScope.ReferenceLine
| Parameter | Type | Default |
|---|---|---|
y | Double | - |
stroke | Color? | null |
strokeDasharray | List<Float>? | null |
label | String? | null |
CartesianChartScope.ReferenceArea
| Parameter | Type | Default |
|---|---|---|
x1 | Int | - |
x2 | Int | - |
fill | Color? | null |
fillOpacity | Float | 0.5f |
CartesianChartScope.ChartTooltip
| Parameter | Type | Default |
|---|---|---|
defaultIndex | Int? | null |
cursor | ChartCursor? | ChartCursor() |
content | @Composable ChartTooltipScope.() -> Unit | { ChartTooltipContent() } |
CartesianChartScope.ChartLegend
| Parameter | Type | Default |
|---|---|---|
hideIcon | Boolean | false |
LineChart
Cartesian chart for Line series.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | CartesianChartScope<T>.() -> Unit | - |
AreaChart
Cartesian chart for Area series, with optional stacking.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
stackOffset | ChartStackOffset: None | Expand | ChartStackOffset.None |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | CartesianChartScope<T>.() -> Unit | - |
BarChart
Cartesian chart for Bar series, vertical or horizontal.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
layout | ChartLayout: Horizontal | Vertical | ChartLayout.Horizontal |
barGap | Dp | 4.dp |
barCategoryGap | Dp? | null |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | CartesianChartScope<T>.() -> Unit | - |
ComposedChart
Cartesian chart that mixes lines, areas and bars.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | CartesianChartScope<T>.() -> Unit | - |
PieChartScope.Pie
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
value | (T) -> Double | - |
nameKey | (T) -> String | - |
innerRadius | Float | 0f |
outerRadius | Float | 0.8f |
cx | Float | 0.5f |
cy | Float | 0.5f |
startAngle | Float | 0f |
endAngle | Float | 360f |
paddingAngle | Float | 0f |
cornerRadius | Dp | 0.dp |
stroke | Color? | null |
strokeWidth | Dp | 1.dp |
fillOpacity | Float | 1f |
cells | ((Int) -> ChartCell)? | null |
sectors | ((Int) -> ChartSector)? | null |
label | ((Int) -> String)? | null |
labelLine | Color? | null |
isAnimationActive | Boolean | true |
animationDuration | Int | 1500 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
PieChartScope.ChartTooltip
| Parameter | Type | Default |
|---|---|---|
defaultIndex | Int? | null |
content | @Composable ChartTooltipScope.() -> Unit | { ChartTooltipContent() } |
PieChartScope.ChartLegend
| Parameter | Type | Default |
|---|---|---|
hideIcon | Boolean | false |
RadialBarChartScope.PolarAngleAxis
| Parameter | Type | Default |
|---|---|---|
domain | ClosedFloatingPointRange<Double> | - |
RadialBarChartScope.RadialBar
| Parameter | Type | Default |
|---|---|---|
dataKey | String | - |
value | (T) -> Double | - |
nameKey | ((T) -> String)? | null |
fill | Color? | null |
cornerRadius | Dp | 0.dp |
background | Color? | null |
stackId | String? | null |
stroke | Color? | null |
strokeWidth | Dp | 0.dp |
cells | ((Int) -> ChartCell)? | null |
labelList | ChartLabelList? | null |
isAnimationActive | Boolean | true |
animationDuration | Int | 1500 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
RadialBarChartScope.ChartTooltip
| Parameter | Type | Default |
|---|---|---|
defaultIndex | Int? | null |
content | @Composable ChartTooltipScope.() -> Unit | { ChartTooltipContent() } |
RadialBarChartScope.ChartLegend
| Parameter | Type | Default |
|---|---|---|
hideIcon | Boolean | false |
PieChart
Pie and donut charts built from Pie.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | PieChartScope.() -> Unit | - |
RadialBarChart
Circular bars built from RadialBar.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
innerRadius | Float | 0f |
outerRadius | Float | 0.8f |
cx | Float | 0.5f |
cy | Float | 0.5f |
startAngle | Float | 0f |
endAngle | Float | 360f |
barSize | Dp? | null |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | RadialBarChartScope<T>.() -> Unit | - |
PolarGridType
Values: Polygon, Circle.
RadarChartScope.PolarGrid
| Parameter | Type | Default |
|---|---|---|
gridType | PolarGridType: Polygon | Circle | PolarGridType.Polygon |
stroke | Color? | null |
strokeWidth | Dp | 1.dp |
fill | Color? | null |
fillOpacity | Float | 1f |
RadarChartScope.PolarAngleAxis
| Parameter | Type | Default |
|---|---|---|
label | (T) -> String | - |
tickStyle | TextStyle? | null |
activeTickStyle | TextStyle? | null |
RadarChartScope.PolarRadiusAxis
| Parameter | Type | Default |
|---|---|---|
angle | Float | 0f |
domain | ClosedFloatingPointRange<Double>? | null |
tickCount | Int | 5 |
tick | Boolean | true |
tickStyle | TextStyle? | null |
RadarChartScope.Radar
| Parameter | Type | Default |
|---|---|---|
dataKey | String | - |
value | (T) -> Double | - |
fill | Color? | null |
fillOpacity | Float | 1f |
stroke | Color? | null |
strokeWidth | Dp | 1.dp |
strokeOpacity | Float | 1f |
dot | ChartDot? | null |
activeDot | ChartDot? | ChartDot(4.dp) |
isAnimationActive | Boolean | true |
animationDuration | Int | 1500 |
animationEasing | ChartEasing: Ease | EaseIn | EaseOut | EaseInOut | Linear | ChartEasing.Ease |
RadarChartScope.ChartTooltip
| Parameter | Type | Default |
|---|---|---|
defaultIndex | Int? | null |
cursor | ChartCursor? | ChartCursor() |
content | @Composable ChartTooltipScope.() -> Unit | { ChartTooltipContent() } |
RadarChartScope.ChartLegend
| Parameter | Type | Default |
|---|---|---|
hideIcon | Boolean | false |
RadarChart
Polar chart built from Radar and PolarGrid.
| Parameter | Type | Default |
|---|---|---|
data | List<T> | - |
modifier | Modifier | Modifier |
margin | ChartMargin | ChartMargin() |
outerRadius | Float | 0.8f |
cy | Float | 0.5f |
accessibilityLabel | String? | null |
selectedIndex | Int? | null |
onSelectedIndexChange | ((Int?) -> Unit)? | null |
content | RadarChartScope<T>.() -> Unit | - |







