Proposal: Circle Charts API #3
hdralexandru
started this conversation in
Ideas
Replies: 2 comments
-
Let's move the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Use |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
📢 Place of discussion for the Circle's Chart API
See the current proposal beneath. React with 👍🏻 if you like it or with 👎🏻 if you don't.
If you 👎🏻 the API, please specify why and suggest an alternative.
The API
We are suggesting the following approach
Pie Chart
See PieChart for more info about bar charts.
modifier: Modifier
The
Modifier
object from compose, used for customizing the behaviour of this composable.data: List<Slice>
Slice
is the data class used for passing the information to us.sliceColors: List<Color>
The colors used for each slice. This list should have the same size as
slices
angleOffset: Float
By default, we use start drawing the first slice from the 12 o'clock, counter-clockwise.
The user may use this to offset the position from which we start drawing.
The value can be negative.
marginBetweenSlices: Dp
Space between 2 slices. 0 by default.
labelStyle: TextStyle
The style applied to the labels.
labelPosition
The user has a few options regarding the placement of the labels: inside the slice, outside the slice or no label, if the user wants to handle the labels on their own.
Depending on the size of the slice, the label might not fit inside. This is the reason for why we use a provider function here.
DonutChart
See What is a donut chart for more info about donut chart.
Most of the API is the same as in the PieChart section. However, there are a couple of differences.
donutHoleRatio: Float
What percentage of the radius the hole will take. So for
donutHoleRatio=0.5f
, the hole will be half the size of the canvas.We need to define min and max values for this. For
donutHoleRatio=0f
this chart will become a PieChart. FordonutHoleRatio=1f
, this chart won't be visible at all.cornerRadius: CornerSize
See CornerSize.
Beta Was this translation helpful? Give feedback.
All reactions