简体   繁体   English

如何将 24 小时数据放在 x 轴上? MPAndroidChart, Android Studio

[英]How do I put 24 hour data on the x-axis ? MPAndroidChart, Android Studio

I am developing a graph using Android MPAndroidChart.我正在使用 Android MPAndroidChart 开发一个图表。 It shows the DB with 24-hour data in 1 minute units as a graph.它以 1 分钟为单位显示具有 24 小时数据的数据库。 I get data from DB well, but I don't know how to set the x-axis format.我很好地从数据库中获取数据,但我不知道如何设置 x 轴格式。

enter image description here在此处输入图像描述

enter image description here在此处输入图像描述

Image 1 is the ideal graph I want, and image 2 is the actual graph.图 1 是我想要的理想图,图 2 是实际图。

my code is我的代码是

 xAxis1.setValueFormatter(new IndexAxisValueFormatter(xVals)); tempChart.setData(data1); tempChart.notifyDataSetChanged(); tempChart.invalidate();

In summary, it goes like this: Because there is data every minute, is the x-axis value omitted because there are too many?总结起来就是这样:因为每分钟都有数据,是不是因为太多而省略了x轴值? Or is there another way...;还是有其他方法...;

enter image description here在此处输入图像描述

I put image 2 wrong.我把图2错了。 As in this image, only half of the x-axis values come out.就像在这张图片中,只有一半的 x 轴值出来了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM