Skip to content

Commit e42da65

Browse files
committed
Fix granularity when force label enabled
1 parent fa9febb commit e42da65

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/renderer/AxisRenderer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ protected void computeAxisValues(float min, float max) {
188188
if (mAxis.isForceLabelsEnabled()) {
189189

190190
interval = (float) range / (float) (labelCount - 1);
191+
// When force label is enabled
192+
// If granularity is enabled, then do not allow the interval to go below specified granularity.
193+
if (mAxis.isGranularityEnabled())
194+
interval = interval < mAxis.getGranularity() ? mAxis.getGranularity() : interval;
195+
191196
mAxis.mEntryCount = labelCount;
192197

193198
// Ensure stops contains at least numStops elements.

0 commit comments

Comments
 (0)