android - 如何为 MPAndroidChart 中的每个 y 值设置 x 轴标签?

标签 android linechart mpandroidchart

我想为折线图中的每个 y 值在 x 轴上设置一个标签。我想得到这个结果:

a LineChart with labels on the x-axis for every point

有人可以帮助我在 MPAndroidChart 中找到正确的方法吗? ?

最佳答案

您可能正在寻找粒度 - 参见the wiki page for the axisjavadoc .

这样调用:

 mChart.getXAxis().setGranularity(0.3f);
 mChart.getXAxis().setGranularityEnabled(true);

将确保 0.3 是放大时轴上的最小间隔。除此之外,您可能需要通过调用以下方法调整 x 轴的比例:

mChart.getXAxis().setAxisMinValue(10.01f); //experiment with these values
mChart.getXAxis().setAxisMaxValue(10.14f);
mChart.getXAxis().setLabelCount(5);

关于android - 如何为 MPAndroidChart 中的每个 y 值设置 x 轴标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44415358/

相关文章:

Android:如何与microSD卡进行SPI通信

android - 选项卡内容在 Android 应用程序中重叠

java - jsp页面中的交互式JFreeChart

android - 如何在相同的 x,y 值上管理多个标记 View

android - 在 iOS 上不接收通知 react-native-push-notification

android - 启动和绑定(bind)的服务的生命周期?

charts - 如何在 Crystal Reports 中实现多系列折线图?

Android AChartEngine - 无法更改 Y 轴标签的文本颜色

java - MPAndroidChart 我想更改限制线顶部图表的颜色

android - 如何重置 MPAndroidChart 中的缩放级别?