From 24eb60ee56be3f986b790dc9ab677371c1cf1d5d Mon Sep 17 00:00:00 2001 From: ewisor Date: Thu, 29 Jun 2017 08:56:53 -0700 Subject: [PATCH 1/8] Added a PieDataSet option to not draw pie chart slice text if percent value is less than a configurable threshold (threshold defaults to 0.0% so text is normally always drawn). (cherry picked from commit 4a4f46165fef8e362389b67b3bc93f44a76ea5e4) --- .../com/github/mikephil/charting/data/PieDataSet.java | 11 +++++++++++ .../charting/interfaces/datasets/IPieDataSet.java | 4 ++++ .../mikephil/charting/renderer/PieChartRenderer.java | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java index e592399513..bb42479f9b 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java @@ -29,6 +29,7 @@ public class PieDataSet extends DataSet implements IPieDataSet { private float mValueLinePart1Length = 0.3f; private float mValueLinePart2Length = 0.4f; private boolean mValueLineVariableLength = true; + private float mDrawValuePercentThreshold = 2.0f; public PieDataSet(List yVals, String label) { super(yVals, label); @@ -218,6 +219,16 @@ public void setValueLineVariableLength(boolean valueLineVariableLength) { this.mValueLineVariableLength = valueLineVariableLength; } + /** Draw values on chart if the percent value is equal to or exceeds this percent threshold */ + @Override public float getDrawValuePercentThreshold() { + return mDrawValuePercentThreshold; + } + + public void setDrawValuePercentThreshold(float drawValuePercentThreshold) + { + this.mDrawValuePercentThreshold = drawValuePercentThreshold; + } + public enum ValuePosition { INSIDE_SLICE, OUTSIDE_SLICE diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IPieDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IPieDataSet.java index 1698ef786b..13652f103a 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IPieDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IPieDataSet.java @@ -70,5 +70,9 @@ public interface IPieDataSet extends IDataSet { * */ boolean isValueLineVariableLength(); + /** + * Draw values on chart if the percent value is equal to or exceeds this threshold + * */ + float getDrawValuePercentThreshold(); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java index c9f653e808..43fd9ef280 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java @@ -501,6 +501,12 @@ public void drawValues(Canvas c) { String formattedValue = formatter.getPieLabel(value, entry); String entryLabel = entry.getLabel(); + // Do not draw text if percent value is less than the threshold + if (entry.getY() / yValueSum * 100f < dataSet.getDrawValuePercentThreshold()) { + xIndex++; + continue; + } + final float sliceXBase = (float) Math.cos(transformedAngle * Utils.FDEG2RAD); final float sliceYBase = (float) Math.sin(transformedAngle * Utils.FDEG2RAD); From 56b9acc7f28046723eb854672759d75e6330acd0 Mon Sep 17 00:00:00 2001 From: ewisor Date: Thu, 29 Jun 2017 09:14:11 -0700 Subject: [PATCH 2/8] Changed newly added threshold default to 0.0% so text is normally always drawn. (cherry picked from commit 4b0fdfcdd4b7db4dc11e2000fed3d148fd41f632) --- .../main/java/com/github/mikephil/charting/data/PieDataSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java index bb42479f9b..18a8dd574f 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieDataSet.java @@ -29,7 +29,7 @@ public class PieDataSet extends DataSet implements IPieDataSet { private float mValueLinePart1Length = 0.3f; private float mValueLinePart2Length = 0.4f; private boolean mValueLineVariableLength = true; - private float mDrawValuePercentThreshold = 2.0f; + private float mDrawValuePercentThreshold = 0.0f; public PieDataSet(List yVals, String label) { super(yVals, label); From 97afcbd54a92edecc7dfaac79179d741f349876d Mon Sep 17 00:00:00 2001 From: Raji Date: Tue, 11 Jul 2017 14:41:47 -0500 Subject: [PATCH 3/8] Labels at specific positions for x and y axis #2692 (cherry picked from commit c85e212d080d9506f8daba9e72511ad81ae87c55) --- .../charting/components/AxisBase.java | 33 +++++++++++++++++++ .../charting/renderer/XAxisRenderer.java | 25 +++++++++----- .../charting/renderer/YAxisRenderer.java | 17 ++++++++++ 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java index c1f02828be..5522872ed8 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java @@ -151,6 +151,16 @@ public abstract class AxisBase extends ComponentBase { */ public float mAxisRange = 0f; + /** + * if true, then labels are displayed using specificLabelPositions instead of computed ones + */ + private boolean showSpecificLabelPositions = false; + + /** + * specify to which values labels must be displayed. has no effect if not used showSpecificLabelPositions set to true + */ + private float[] specificLabelPositions = new float[]{}; + /** * default constructor */ @@ -779,4 +789,27 @@ public void setSpaceMax(float mSpaceMax) { this.mSpaceMax = mSpaceMax; } + + /** + * if set to true, labels will be displayed at the specific positions passed in via setSpecificLabelPositions + */ + public void setShowSpecificLabelPositions(boolean showSpecificLabelPositions) + { + this.showSpecificLabelPositions = showSpecificLabelPositions; + } + + public boolean isShowSpecificLabelPositions() + { + return showSpecificLabelPositions; + } + + public void setSpecificLabelPositions(float[] specificLabelPositions) + { + this.specificLabelPositions = specificLabelPositions; + } + + public float[] getSpecificLabelPositions() + { + return specificLabelPositions; + } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java index 046f3469bc..7d6ec43de9 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java @@ -183,13 +183,20 @@ protected void drawLabels(Canvas c, float pos, MPPointF anchor) { float[] positions = new float[mXAxis.mEntryCount * 2]; - for (int i = 0; i < positions.length; i += 2) { - - // only fill x values - if (centeringEnabled) { - positions[i] = mXAxis.mCenteredEntries[i / 2]; - } else { - positions[i] = mXAxis.mEntries[i / 2]; + if (mXAxis.isShowSpecificLabelPositions()) { + positions = new float[mXAxis.getSpecificLabelPositions().length * 2]; + for (int i = 0; i < positions.length; i += 2) { + positions[i] = mXAxis.getSpecificLabelPositions()[i / 2]; + } + } else { + for (int i = 0; i < positions.length; i += 2) { + + // only fill x values + if (centeringEnabled) { + positions[i] = mXAxis.mCenteredEntries[i / 2]; + } else { + positions[i] = mXAxis.mEntries[i / 2]; + } } } @@ -201,7 +208,9 @@ protected void drawLabels(Canvas c, float pos, MPPointF anchor) { if (mViewPortHandler.isInBoundsX(x)) { - String label = mXAxis.getValueFormatter().getAxisLabel(mXAxis.mEntries[i / 2], mXAxis); + String label = mXAxis.isShowSpecificLabelPositions() ? + mXAxis.getValueFormatter().getAxisLabel(mXAxis.getSpecificLabelPositions()[i / 2], mXAxis) + : mXAxis.getValueFormatter().getAxisLabel(mXAxis.mEntries[i / 2], mXAxis); if (mXAxis.isAvoidFirstLastClippingEnabled()) { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java index a2bf679777..6d0988fb9d 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java @@ -114,6 +114,23 @@ public void renderAxisLine(Canvas c) { */ protected void drawYLabels(Canvas c, float fixedPosition, float[] positions, float offset) { + if (mYAxis.isShowSpecificLabelPositions()) { + float[] specificLabelsPositions = new float[mYAxis.getSpecificLabelPositions().length * 2]; + for (int i = 0; i < mYAxis.getSpecificLabelPositions().length; i++) { + specificLabelsPositions[i * 2 + 1] = mYAxis.getSpecificLabelPositions()[i]; + } + mTrans.pointValuesToPixel(specificLabelsPositions); + + for (int i = 0; i < mYAxis.getSpecificLabelPositions().length; i++) { + float y = specificLabelsPositions[i * 2 + 1]; + if (mViewPortHandler.isInBoundsY(y)) { + String text = mYAxis.getValueFormatter().getFormattedValue(mYAxis.getSpecificLabelPositions()[i], mYAxis); + c.drawText(text, fixedPosition, y + offset, mAxisLabelPaint); + } + } + return; + } + final int from = mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1; final int to = mYAxis.isDrawTopYLabelEntryEnabled() ? mYAxis.mEntryCount From d824baf990fec24de8fe685d59221d2c3ef2aa98 Mon Sep 17 00:00:00 2001 From: Dan Boxler Date: Tue, 15 Aug 2017 15:46:36 -0600 Subject: [PATCH 4/8] adding checks to make sure we don't cause an IndexOutOfBoundsException with an empty list (cherry picked from commit 79a4695ef4f5a6d781bff176f076b1a4dbfe158c) --- .../main/java/com/github/mikephil/charting/data/DataSet.java | 2 ++ .../github/mikephil/charting/renderer/LineChartRenderer.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java index 3c69d9c58f..484a2313ae 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java @@ -291,6 +291,8 @@ public T getEntryForXValue(float xValue, float closestToY) { @Override public T getEntryForIndex(int index) { + // Avoid an IndexOutOfBoundsException if we try access an item outside out list + if (index >= mValues.size()) return null; return mValues.get(index); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java index ead9d6d701..8b3dfaf957 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java @@ -571,7 +571,7 @@ public void drawValues(Canvas c) { drawValue(c, formatter.getPointLabel(entry), x, y - valOffset, dataSet.getValueTextColor(j / 2)); } - if (entry.getIcon() != null && dataSet.isDrawIconsEnabled()) { + if (entry != null && entry.getIcon() != null && dataSet.isDrawIconsEnabled()) { Drawable icon = entry.getIcon(); From eeee52b99c432ecf30df4893a75d97f05a674d1a Mon Sep 17 00:00:00 2001 From: Raji Date: Tue, 15 Aug 2017 22:00:56 -0500 Subject: [PATCH 5/8] Fix for ArrayIndexOutOfBoundsException - when highlighting full bar on CombinedChart (cherry picked from commit 80260148d6b3fc9c59cd8182995eaade26a5eb1b) --- .../mikephil/charting/charts/CombinedChart.java | 1 + .../mikephil/charting/highlight/Highlight.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.java index cd01f0ef73..c251faba64 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/CombinedChart.java @@ -119,6 +119,7 @@ public Highlight getHighlightByTouchPoint(float x, float y) { // For isHighlightFullBarEnabled, remove stackIndex return new Highlight(h.getX(), h.getY(), h.getXPx(), h.getYPx(), + h.getDataIndex(), h.getDataSetIndex(), -1, h.getAxis()); } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java index 032698d5e5..eb860268ad 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java @@ -101,6 +101,22 @@ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, int s this.mStackIndex = stackIndex; } + /** + * Constructor, only used for for Combined Chart. + * + * @param x the index of the highlighted value on the x-axis + * @param y the y-value of the highlighted value + * @param dataIndex the index of the highlighted data entry + * @param dataSetIndex the index of the DataSet the highlighted value belongs to + * @param stackIndex references which value of a stacked-bar entry has been + * selected + */ + public Highlight(float x, float y, float xPx, float yPx, int dataIndex, int dataSetIndex, int stackIndex, YAxis.AxisDependency axis) { + this(x, y, xPx, yPx, dataSetIndex, axis); + this.mStackIndex = stackIndex; + this.mDataIndex = dataIndex; + } + /** * returns the x-value of the highlighted value * From 8a736957cded62db603474d4423ca83711486dcf Mon Sep 17 00:00:00 2001 From: ewisor Date: Mon, 11 Dec 2017 08:54:14 -0800 Subject: [PATCH 6/8] Andromeda customizations to sup[port showing breaks/gaps in line charts. (cherry picked from commit d7e69b9cf5684d6834fd3ac3e0f7d1d5881de927) --- .../charting/renderer/LineChartRenderer.java | 74 ++++++++++++++++--- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java index 8b3dfaf957..421100110b 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java @@ -57,6 +57,22 @@ public class LineChartRenderer extends LineRadarRenderer { protected Path cubicPath = new Path(); protected Path cubicFillPath = new Path(); + // Andromeda Additions + private float noDataValue = Float.MIN_VALUE; + private float noDataTransitionWidth = 0.33f; // As a percent of the normal entry width + public void setNoDataValue(float noDataValue) { + this.noDataValue = noDataValue; + } + public void setNoDataTransitionWidth(float noDataTransitionWidth) { + this.noDataTransitionWidth = noDataTransitionWidth; + } + private float getAdjustedY(Entry entry, float fillMin) { + return (isNoDataValue(entry) ? fillMin : entry.getY()); + } + private boolean isNoDataValue(Entry entry) { + return (entry == null || entry.getY() <= noDataValue); + } + public LineChartRenderer(LineDataProvider chart, ChartAnimator animator, ViewPortHandler viewPortHandler) { super(animator, viewPortHandler); @@ -394,24 +410,48 @@ protected void drawLinear(Canvas c, ILineDataSet dataSet) { if (e1 == null || e2 == null) continue; + if (isNoDataValue(e1) || (!isDrawSteppedEnabled && isNoDataValue(e2))) { + // If the previous sample is valid but the current one is not + if(!isNoDataValue(e1) && isNoDataValue(e2)) { + // Draw a no data transition leaving the previous entry + mLineBuffer[j++] = e1.getX(); + mLineBuffer[j++] = e1.getY() * phaseY; + mLineBuffer[j++] = e1.getX() + noDataTransitionWidth; + mLineBuffer[j++] = e1.getY() * phaseY; + } + // If the previous sample was not valid and the current one is valid + else if(isNoDataValue(e1) && !isNoDataValue(e2) && !isDrawSteppedEnabled) { + // Draw a no data transition entering the current entry + mLineBuffer[j++] = e2.getX() - noDataTransitionWidth; + mLineBuffer[j++] = e2.getY() * phaseY; + mLineBuffer[j++] = e2.getX(); + mLineBuffer[j++] = e2.getY() * phaseY; + } + continue; + } + mLineBuffer[j++] = e1.getX(); mLineBuffer[j++] = e1.getY() * phaseY; if (isDrawSteppedEnabled) { mLineBuffer[j++] = e2.getX(); mLineBuffer[j++] = e1.getY() * phaseY; - mLineBuffer[j++] = e2.getX(); - mLineBuffer[j++] = e1.getY() * phaseY; + if (!isNoDataValue(e2)) { + mLineBuffer[j++] = e2.getX(); + mLineBuffer[j++] = e1.getY() * phaseY; + } } - mLineBuffer[j++] = e2.getX(); - mLineBuffer[j++] = e2.getY() * phaseY; + if (!isNoDataValue(e2)) { + mLineBuffer[j++] = e2.getX(); + mLineBuffer[j++] = e2.getY() * phaseY; + } } if (j > 0) { trans.pointValuesToPixel(mLineBuffer); - final int size = Math.max((mXBounds.range + 1) * pointsPerEntryPair, pointsPerEntryPair) * 2; + final int size = j; // Math.max((mXBounds.range + 1) * pointsPerEntryPair, pointsPerEntryPair) * 2; mRenderPaint.setColor(dataSet.getColor()); @@ -493,7 +533,7 @@ private void generateFilledPath(final ILineDataSet dataSet, final int startIndex final Entry entry = dataSet.getEntryForIndex(startIndex); filled.moveTo(entry.getX(), fillMin); - filled.lineTo(entry.getX(), entry.getY() * phaseY); + filled.lineTo(entry.getX(), getAdjustedY(entry, fillMin) * phaseY); // create a new path Entry currentEntry = null; @@ -502,12 +542,28 @@ private void generateFilledPath(final ILineDataSet dataSet, final int startIndex currentEntry = dataSet.getEntryForIndex(x); + // Changes to show gaps for no data. Note: The stepped and non-stepped implementations + // are similar and could be optimized for code size however That will make each code path + // harder to follow. if (isDrawSteppedEnabled) { - filled.lineTo(currentEntry.getX(), previousEntry.getY() * phaseY); + filled.lineTo(currentEntry.getX(), getAdjustedY(previousEntry, fillMin) * phaseY); + filled.lineTo(currentEntry.getX(), getAdjustedY(currentEntry, fillMin) * phaseY); + } else { + if (isNoDataValue(previousEntry)) { + if (!isNoDataValue(currentEntry)) { + filled.lineTo(currentEntry.getX() - noDataTransitionWidth, getAdjustedY(previousEntry, fillMin) * phaseY); + filled.lineTo(currentEntry.getX() - noDataTransitionWidth, getAdjustedY(currentEntry, fillMin) * phaseY); + } + else { + filled.lineTo(currentEntry.getX(), getAdjustedY(previousEntry, fillMin) * phaseY); + } + } else if (isNoDataValue(currentEntry)) { + filled.lineTo(previousEntry.getX() + noDataTransitionWidth, getAdjustedY(previousEntry, fillMin) * phaseY); + filled.lineTo(previousEntry.getX() + noDataTransitionWidth, fillMin * phaseY); + } + filled.lineTo(currentEntry.getX(), getAdjustedY(currentEntry, fillMin) * phaseY); } - filled.lineTo(currentEntry.getX(), currentEntry.getY() * phaseY); - previousEntry = currentEntry; } From c65f2f58a5faf8d4491325a0f798e697dfc5b30c Mon Sep 17 00:00:00 2001 From: ewisor Date: Mon, 11 Dec 2017 16:05:42 -0800 Subject: [PATCH 7/8] Set the default "No Data Value" to the largest negative float value (previous was the smallest positive float value - big difference!) (cherry picked from commit 1797983657ae96c43d27f5f2e6c0880a212e694f) --- .../github/mikephil/charting/renderer/LineChartRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java index 421100110b..8a514cc252 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java @@ -58,7 +58,7 @@ public class LineChartRenderer extends LineRadarRenderer { protected Path cubicFillPath = new Path(); // Andromeda Additions - private float noDataValue = Float.MIN_VALUE; + private float noDataValue = -Float.MAX_VALUE; private float noDataTransitionWidth = 0.33f; // As a percent of the normal entry width public void setNoDataValue(float noDataValue) { this.noDataValue = noDataValue; From bd836f6fc8359e4633d68cf7ddbcda32805b114f Mon Sep 17 00:00:00 2001 From: ewisor Date: Tue, 12 Dec 2017 08:17:15 -0800 Subject: [PATCH 8/8] Changed default no data value to Float.NaN - this guarantees the newly added feature is disable by default. Also, resolved a bug where check for the no data value was including values less than the no data value. Now value must be exactly the same. (cherry picked from commit 21b4acccb6c72e8a34fec998d2d82d457ce3cb28) --- .../github/mikephil/charting/renderer/LineChartRenderer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java index 8a514cc252..4b28092cfa 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java @@ -58,7 +58,7 @@ public class LineChartRenderer extends LineRadarRenderer { protected Path cubicFillPath = new Path(); // Andromeda Additions - private float noDataValue = -Float.MAX_VALUE; + private float noDataValue = Float.NaN; private float noDataTransitionWidth = 0.33f; // As a percent of the normal entry width public void setNoDataValue(float noDataValue) { this.noDataValue = noDataValue; @@ -70,7 +70,7 @@ private float getAdjustedY(Entry entry, float fillMin) { return (isNoDataValue(entry) ? fillMin : entry.getY()); } private boolean isNoDataValue(Entry entry) { - return (entry == null || entry.getY() <= noDataValue); + return (entry == null || entry.getY() == noDataValue); } public LineChartRenderer(LineDataProvider chart, ChartAnimator animator,