MP Android Chart 中的 xAxis getAxisLabel(value: Float, axis: AxisBase?) 值显示负数 -1
如何解决Xaxis mpcharts中值为-1的问题?由于这个问题,我在Xaxis中的第一个数组没有显示。
inner class MyAxisFormatter : IndexAxisValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
var xValue = ""
val index = value.toInt()
Log.d("Main Activity", "value: " + value)
xValue = if (index < Month_AmountArrayList.size && index > 0) {
Month_AmountArrayList[index].month
} else {
""
}
return xValue
}
}
数组中的2个元素:
logcat中的输出:
电话中的输出:
图表输出未显示JAN
How to solve the problem where the value in xAxis Mpcharts is -1? Because of this problem, my first array in xAxis is not showing.
inner class MyAxisFormatter : IndexAxisValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
var xValue = ""
val index = value.toInt()
Log.d("Main Activity", "value: " + value)
xValue = if (index < Month_AmountArrayList.size && index > 0) {
Month_AmountArrayList[index].month
} else {
""
}
return xValue
}
}
2 elements in the array:
The output in logcat:
The output in phone:
chart output not showing Jan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论