Skip to content

Commit

Permalink
Merge pull request #20307 from wordpress-mobile/Stats-Traffic-Fix-Lab…
Browse files Browse the repository at this point in the history
…el-formatters

Stats traffic fix label formatters
  • Loading branch information
irfano authored Feb 28, 2024
2 parents 9adaa0b + a48a3de commit cd84262
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BarChartLabelFormatter @Inject constructor(
) : ValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
val index = value.toInt()
return if (index in 0..entries.size) {
return if (entries.isNotEmpty() && index in 0..entries.size) {
entries[index].label
} else {
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LineChartLabelFormatter @Inject constructor(
) : ValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
val index = value.toInt()
return if (index in 0..entries.size) {
return if (entries.isNotEmpty() && index in 0..entries.size) {
entries[index].label
} else {
""
Expand Down

0 comments on commit cd84262

Please sign in to comment.