Legends
A Legend
describes the elements present on a CartesianChart
. There are two built-in implementations: HorizontalLegend
and VerticalLegend
. These Legend
s consist of LegendItem
s.
Create a HorizontalLegend
as follows:
- Compose
- Views
rememberHorizontalLegend(
items =
rememberExtraLambda {
add(LegendItem(...))
...
},
...
)
HorizontalLegend(
items = {
add(LegendItem(...))
...
},
...
)
Create a VerticalLegend
as follows:
- Compose
- Views
rememberVerticalLegend(
items =
rememberExtraLambda {
add(LegendItem(...))
...
},
...
)
VerticalLegend(
items = {
add(LegendItem(...))
...
},
...
)
Add a Legend
to a CartesianChart
as follows:
- Compose
- Views
CartesianChartHost(chart = rememberCartesianChart(legend = ..., ...), ...)
cartesianChartView.chart.legend = ...