Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ internal fun DrawScope.drawAxisData(
radarLabels: List<String>,
scalarValue: Double,
scalarSteps: Int,
unit: String
unit: String,
showScalarValues: Boolean
) {

val labelsEndPoints = radarChartConfig.labelsPoints
Expand All @@ -31,18 +32,21 @@ internal fun DrawScope.drawAxisData(
val labelHeight = textMeasurer.measure(AnnotatedString("M")).size.height


for (step in 0 until scalarSteps) {
drawText(
textMeasurer = textMeasurer,
text = (scalarStep * step).toString() + " " + unit,
style = scalarValuesStyle,
topLeft = Offset(
nextStartPoints[step].x + 5.toDp().toPx(),
nextStartPoints[step].y - textVerticalOffset
if (showScalarValues) {
for (step in 0 until scalarSteps) {
drawText(
textMeasurer = textMeasurer,
text = (scalarStep * step).toString() + " " + unit,
style = scalarValuesStyle,
topLeft = Offset(
nextStartPoints[step].x + 5.toDp().toPx(),
nextStartPoints[step].y - textVerticalOffset
)
)
)
}
}


for (line in labelsEndPoints.indices) {
drawText(
textMeasurer = textMeasurer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.aay.compose.radarChart.model.Polygon
* @param scalarValue Scalar value to determine the scale of the radar chart.
* @param scalarValuesStyle TextStyle for configuring the appearance of scalar value labels.
* @param polygons List of polygons to be displayed on the radar chart.
* @param showScalarValues Flag to determine whether to display scalar values on the radar chart (default is true).
* @param modifier Modifier for configuring the layout and appearance of the radar chart.
*
* @see Polygon
Expand All @@ -37,6 +38,7 @@ fun RadarChart(
scalarValue: Double,
scalarValuesStyle: TextStyle,
polygons: List<Polygon>,
showScalarValues: Boolean = true,
modifier: Modifier = Modifier
) {

Expand Down Expand Up @@ -74,7 +76,8 @@ fun RadarChart(
radarLabels,
scalarValue,
scalarSteps,
polygons[0].unit
polygons[0].unit,
showScalarValues
)

}
Expand Down