JIDE 3.5.15

com.jidesoft.chart
Class AbstractAutoRanger

java.lang.Object
  extended by com.jidesoft.chart.AbstractAutoRanger
All Implemented Interfaces:
AutoRanger
Direct Known Subclasses:
DefaultAutoRanger, ZeroAlignedAutoRanger

public abstract class AbstractAutoRanger
extends Object
implements AutoRanger

This class now also supports the idea of concrete maxima and minima. These are optional parameters that can be set to replace infinite upper and lower bounds on a range. For example, when a chart model contains only NaN values, then the computed range will be [-Infinity, +Infinity]. Although this is mathematically correct, it means that the range can no longer be subdivided neatly into sub-regions and it is therefore no longer possible to paint ticks on the axis. From a user's point of view this behaviour may be disturbing and the user might even perceive that there is a bug in the system. The absolute maxima and minima have been introduced to address this problem.


Constructor Summary
protected AbstractAutoRanger()
           
protected AbstractAutoRanger(Double fixMinX, Double fixMinY, Double fixMaxX, Double fixMaxY)
           
 
Method Summary
protected  Pair<Range<?>,Range<?>> applyRangeConstraints(Axis xAxis, Axis yAxis, double minX, double minY, double maxX, double maxY)
          Post-processes the ranges of the supplied x and y axes to apply the minimum and maximum values
protected  Range<?> applyXRangeConstraints(Axis xAxis, double minX, double maxX)
           
protected  Range<?> applyYRangeConstraints(Axis yAxis, double minY, double maxY)
           
 Double getAbsoluteMaxX()
          Returns the concrete maximum value for x
 Double getAbsoluteMaxY()
          Returns the concrete maximum value for y
 Double getAbsoluteMinX()
          Returns the concrete minimum value for x
 Double getAbsoluteMinY()
          Returns the concrete minimum value for y
 double getLeadingXMarginProportion()
           
 double getLeadingYMarginProportion()
           
 Pair<Range<?>,Range<?>> getRanges(ChartModel model)
          Returns the x and y ranges for the supplied chart model
 Pair<Range<?>,Range<?>> getStackedRanges(Chart chart)
          Returns the x and y range when plotting a stacked bar chart.
 double getTrailingXMarginProportion()
           
 double getTrailingYMarginProportion()
           
 boolean isAllowXMarginToCrossZero()
           
 boolean isAllowYMarginToCrossZero()
           
 void setAbsoluteMaxX(Double absoluteMaxX)
          Specify a concrete maximum value for x if it would otherwise be +Infinity
 void setAbsoluteMaxY(Double absoluteMaxY)
          Specify a concrete maximum value for y if it would otherwise be +Infinity
 void setAbsoluteMinX(Double absoluteMinX)
          Specify a concrete minimum value for x if it would otherwise be -Infinity
 void setAbsoluteMinY(Double absoluteMinY)
          Specify a concrete minimum value for y if it would otherwise be -Infinity
 void setAllowXMarginToCrossZero(boolean allowXMarginToCrossZero)
           
 void setAllowYMarginToCrossZero(boolean allowYMarginToCrossZero)
          Specify whether the increase to the range by applying the margin is allowed to extend the range by crossing from the positive region into the negative region, or vice versa.
 void setLeadingXMarginProportion(double leadingXMarginProportion)
           
 void setLeadingYMarginProportion(double leadingYMarginProportion)
           
 void setMarginProportions(double top, double left, double bottom, double right)
          Sets the margin proportions to apply to ranges when calculating minima and maxima.
 void setTrailingXMarginProportion(double trailingXMarginProportion)
           
 void setTrailingYMarginProportion(double trailingYMarginProportion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.chart.AutoRanger
getRanges
 

Constructor Detail

AbstractAutoRanger

protected AbstractAutoRanger()

AbstractAutoRanger

protected AbstractAutoRanger(Double fixMinX,
                             Double fixMinY,
                             Double fixMaxX,
                             Double fixMaxY)
Method Detail

setMarginProportions

public void setMarginProportions(double top,
                                 double left,
                                 double bottom,
                                 double right)
Sets the margin proportions to apply to ranges when calculating minima and maxima. If you are setting all the margin proportions this is easier to use than calling the individual setters for each of the margins.

Parameters:
top - the trailing y margin proportion
left - the leading x margin proportion
bottom - the leading y margin proportion
right - the trailing x margin proportion

getLeadingXMarginProportion

public double getLeadingXMarginProportion()

setLeadingXMarginProportion

public void setLeadingXMarginProportion(double leadingXMarginProportion)

getLeadingYMarginProportion

public double getLeadingYMarginProportion()

setLeadingYMarginProportion

public void setLeadingYMarginProportion(double leadingYMarginProportion)

getTrailingXMarginProportion

public double getTrailingXMarginProportion()

setTrailingXMarginProportion

public void setTrailingXMarginProportion(double trailingXMarginProportion)

getTrailingYMarginProportion

public double getTrailingYMarginProportion()

isAllowXMarginToCrossZero

public boolean isAllowXMarginToCrossZero()

setAllowXMarginToCrossZero

public void setAllowXMarginToCrossZero(boolean allowXMarginToCrossZero)

setTrailingYMarginProportion

public void setTrailingYMarginProportion(double trailingYMarginProportion)

isAllowYMarginToCrossZero

public boolean isAllowYMarginToCrossZero()

getAbsoluteMaxX

public Double getAbsoluteMaxX()
Returns the concrete maximum value for x

Returns:
the concrete maximum value for x

setAbsoluteMaxX

public void setAbsoluteMaxX(Double absoluteMaxX)
Specify a concrete maximum value for x if it would otherwise be +Infinity

Parameters:
absoluteMaxX - a maximum value for x

getAbsoluteMaxY

public Double getAbsoluteMaxY()
Returns the concrete maximum value for y

Returns:
the concrete maximum value for y

setAbsoluteMaxY

public void setAbsoluteMaxY(Double absoluteMaxY)
Specify a concrete maximum value for y if it would otherwise be +Infinity

Parameters:
absoluteMaxY - a maximum value for y

getAbsoluteMinX

public Double getAbsoluteMinX()
Returns the concrete minimum value for x

Returns:
the concrete minimum value for x

setAbsoluteMinX

public void setAbsoluteMinX(Double absoluteMinX)
Specify a concrete minimum value for x if it would otherwise be -Infinity

Parameters:
absoluteMinX - a minimum value for x

getAbsoluteMinY

public Double getAbsoluteMinY()
Returns the concrete minimum value for y

Returns:
the concrete minimum value for y

setAbsoluteMinY

public void setAbsoluteMinY(Double absoluteMinY)
Specify a concrete minimum value for y if it would otherwise be -Infinity

Parameters:
absoluteMinY - a minimum value for y

setAllowYMarginToCrossZero

public void setAllowYMarginToCrossZero(boolean allowYMarginToCrossZero)
Specify whether the increase to the range by applying the margin is allowed to extend the range by crossing from the positive region into the negative region, or vice versa. By default this is true, meaning there is no additional restriction and the margin will be applied.

Parameters:
allowYMarginToCrossZero - specify whether allowed to cross from positive to negative (or vice versa) when extending the range.

getRanges

public Pair<Range<?>,Range<?>> getRanges(ChartModel model)
Returns the x and y ranges for the supplied chart model

Parameters:
model - the chart model whose x and y ranges we need to discover
Returns:
a pair of NumericRanges

applyRangeConstraints

protected Pair<Range<?>,Range<?>> applyRangeConstraints(Axis xAxis,
                                                        Axis yAxis,
                                                        double minX,
                                                        double minY,
                                                        double maxX,
                                                        double maxY)
Post-processes the ranges of the supplied x and y axes to apply the minimum and maximum values


applyXRangeConstraints

protected Range<?> applyXRangeConstraints(Axis xAxis,
                                          double minX,
                                          double maxX)

applyYRangeConstraints

protected Range<?> applyYRangeConstraints(Axis yAxis,
                                          double minY,
                                          double maxY)

getStackedRanges

public Pair<Range<?>,Range<?>> getStackedRanges(Chart chart)
Returns the x and y range when plotting a stacked bar chart. This is a special case for finding out the x and y range so is treated separately here

Parameters:
chart - the chart for which we are computing the stacked ranges
Returns:
the X and Y Range as a pair for a stacked bar chart

JIDE 3.5.15