Take care of edge cases when calculating intervals (labelCount == 0)

This commit is contained in:
Daniel Cohen Gindi 2016-08-15 15:21:33 +03:00
parent 1bbf4be1ee
commit 6c17ca45de
2 changed files with 8 additions and 0 deletions

View file

@ -162,6 +162,10 @@ public abstract class AxisRenderer extends Renderer {
// Find out how much spacing (in y value space) between axis values
double rawInterval = range / labelCount;
if (Double.isInfinite(rawInterval))
{
rawInterval = range > 0.0 ? range : 1.0;
}
double interval = Utils.roundToNextSignificant(rawInterval);
// If granularity is enabled, then do not allow the interval to go below specified granularity.

View file

@ -40,6 +40,10 @@ public class YAxisRendererRadarChart extends YAxisRenderer {
// Find out how much spacing (in y value space) between axis values
double rawInterval = range / labelCount;
if (Double.isInfinite(rawInterval))
{
rawInterval = range > 0.0 ? range : 1.0;
}
double interval = Utils.roundToNextSignificant(rawInterval);
// If granularity is enabled, then do not allow the interval to go below specified granularity.