Skip to content

Commit bf7ac56

Browse files
authored
Merge pull request #137 from AppDevNext/anisurrehman-patch-1
Fix granularity when force label enabled
2 parents fa9febb + e42da65 commit bf7ac56

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)