Fix issue causing ANR for empty charts
This commit is contained in:
parent
e9459fb592
commit
0aeddb025e
2 changed files with 4 additions and 10 deletions
|
@ -154,18 +154,15 @@ public abstract class AxisRenderer extends Renderer {
|
|||
int labelCount = mAxis.getLabelCount();
|
||||
double range = Math.abs(yMax - yMin);
|
||||
|
||||
if (labelCount == 0 || range <= 0) {
|
||||
if (labelCount == 0 || range <= 0 || Double.isInfinite(range)) {
|
||||
mAxis.mEntries = new float[]{};
|
||||
mAxis.mCenteredEntries = new float[]{};
|
||||
mAxis.mEntryCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find out how much spacing (in y value space) between axis values
|
||||
double rawInterval = range / labelCount;
|
||||
if (Double.isInfinite(rawInterval))
|
||||
{
|
||||
rawInterval = range > 0.0 && !Double.isInfinite(range) ? range : 1.0;
|
||||
}
|
||||
double interval = Utils.roundToNextSignificant(rawInterval);
|
||||
|
||||
// If granularity is enabled, then do not allow the interval to go below specified granularity.
|
||||
|
|
|
@ -32,18 +32,15 @@ public class YAxisRendererRadarChart extends YAxisRenderer {
|
|||
int labelCount = mAxis.getLabelCount();
|
||||
double range = Math.abs(yMax - yMin);
|
||||
|
||||
if (labelCount == 0 || range <= 0) {
|
||||
if (labelCount == 0 || range <= 0 || Double.isInfinite(range)) {
|
||||
mAxis.mEntries = new float[]{};
|
||||
mAxis.mCenteredEntries = new float[]{};
|
||||
mAxis.mEntryCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find out how much spacing (in y value space) between axis values
|
||||
double rawInterval = range / labelCount;
|
||||
if (Double.isInfinite(rawInterval))
|
||||
{
|
||||
rawInterval = range > 0.0 && !Double.isInfinite(range) ? range : 1.0;
|
||||
}
|
||||
double interval = Utils.roundToNextSignificant(rawInterval);
|
||||
|
||||
// If granularity is enabled, then do not allow the interval to go below specified granularity.
|
||||
|
|
Loading…
Add table
Reference in a new issue