MPAndroidChart x轴数据重复问题

在用MPAndroidChart 中发现 x轴 数据会出现重复,于是乎各种找答案,最后还是在源码中发现了有一个方法

xAxis.setGranularity(1f); //设置x轴每最小刻度  

/**

* Set a minimum interval for the axis when zooming in. The axis is not allowed to go below

* that limit. This can be used to avoid label duplicating when zooming in(PS:这个是关键,幸好我一眼认出了 duplicating,否则还在这个问题上困扰着呢)

*@param granularity

*/

public void setGranularity(float granularity) {

mGranularity = granularity;

    // set this to true if it was disabled, as it makes no sense to call this method with granularity disabled

    mGranularityEnabled =true;

}

你可能感兴趣的:(MPAndroidChart x轴数据重复问题)