在用MPAndroidChart 中發(fā)現(xiàn) x軸?數(shù)據(jù)會(huì)出現(xiàn)重復(fù),于是乎各種找答案,最后還是在源碼中發(fā)現(xiàn)了有一個(gè)方法
xAxis.setGranularity(1f); //設(shè)置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:這個(gè)是關(guān)鍵,幸好我一眼認(rèn)出了?duplicating,否則還在這個(gè)問(wèn)題上困擾著呢)
*@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;
}