Skip to content

Customize vertical axis labels to display text instead of numbers #1002

Closed Answered by willeymr
willeymr asked this question in Questions
Discussion options

You must be logged in to vote

This can be achieved with a custom CartesianValueFormatter:

val startAxisValueFormatter = CartesianValueFormatter { _, value, _ ->
        when {
            value < 1 -> " " // Empty string for zero; avoids writing labels on the origin
            value < 2 -> "L"  // Low
            value < 3 -> "M"  // Medium
            else -> "H"  // High
        }
    }

Then just this pass to your valueFormatter for your vertical axis.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@willeymr
Comment options

@patrickmichalik
Comment options

Answer selected by willeymr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants