Style Intelligence v12.0

inetsoft.graph.scale
Class Scale

java.lang.Object
  extended by inetsoft.graph.scale.Scale
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
CategoricalScale, LinearScale, TimeScale

public abstract class Scale
extends Object
implements Cloneable, Serializable

A scale defines the measurement of a dimension. A scale is used to map a value to its position in the logical coordinate space. The actual position of the rendering for the corresponding graph element is determined by the coordinates and their transformations.

See Also:
Serialized Form

Nested Class Summary
static class Scale.Value
          This class calculate a dynamic scaled value.
 
Field Summary
static int GAPS
          Init option to reserve a small gap at min and max.
static Object MAX_VALUE
          This is a special value that will be mapped to the max of the scale.
static Object MIN_VALUE
          This is a special value that will be mapped to the min of the scale.
static int NO_NULL
          Init option to ignore null values.
static int RAW
          Init option to use the actual data range without any change.
static int TICKS
          Init option to include ticks in scale range.
static int ZERO
          Init option to include zero in scale range.
static Object ZERO_VALUE
          This is a special value that will be mapped to the min or zero (if zero is greater than min).
 
Constructor Summary
protected Scale()
          Create an empty scale.
protected Scale(String[] flds)
          Create a scale for the specified columns.
 
Method Summary
 double add(double v1, double v2)
          Add two mapped values to get the total value.
 Object clone()
          Clone this object.
static Scale createScale(DataSet data, String[] cols)
          Get the default scale for a column.
 boolean equals(Object obj)
          Check if equals another object.
 AxisSpec getAxisSpec()
          Get the associated axis attributes.
 String[] getDataFields()
          Get the columns this scale is initialized from.
 String[] getFields()
          Get the columns this scale is used to measure.
abstract  double getMax()
          Get the max value on the scale.
abstract  double getMin()
          Get the min value on the scale.
 int getScaleOption()
          Get the scale initialization option, e.g.
abstract  double[] getTicks()
          Get the tick positions.
 int getUnitCount()
          Get the number of units if the space is divided into partitions.
abstract  Object[] getValues()
          Get the values at each tick.
 int hashCode()
          Get the hash code value.
abstract  void init(DataSet data)
          Initialize the scale to use the values in the chartLens.
 double map(Object val)
          Map a value to a logical position using this scale.
abstract  double mapValue(Object val)
          Map a value to a logical position using this scale.
 void setAxisSpec(AxisSpec axisSpec)
          Set the attribute for creating the axis for this scale.
 void setDataFields(String[] fields)
          Set the columns this scale is initialized from.
 void setFields(String[] fields)
          Set the columns this scale is used to measure.
 void setScaleOption(int option)
          Set the scale initialization option, e.g.
 String toString()
          Get the string representation.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TICKS

public static final int TICKS
Init option to include ticks in scale range.

See Also:
Constant Field Values

ZERO

public static final int ZERO
Init option to include zero in scale range.

See Also:
Constant Field Values

NO_NULL

public static final int NO_NULL
Init option to ignore null values.

See Also:
Constant Field Values

GAPS

public static final int GAPS
Init option to reserve a small gap at min and max.

See Also:
Constant Field Values

RAW

public static final int RAW
Init option to use the actual data range without any change.

See Also:
Constant Field Values

MIN_VALUE

public static final Object MIN_VALUE
This is a special value that will be mapped to the min of the scale.


MAX_VALUE

public static final Object MAX_VALUE
This is a special value that will be mapped to the max of the scale.


ZERO_VALUE

public static final Object ZERO_VALUE
This is a special value that will be mapped to the min or zero (if zero is greater than min).

Constructor Detail

Scale

protected Scale()
Create an empty scale.


Scale

protected Scale(String[] flds)
Create a scale for the specified columns.

Method Detail

createScale

public static Scale createScale(DataSet data,
                                String[] cols)
Get the default scale for a column.


map

public final double map(Object val)
Map a value to a logical position using this scale. The subclasses should implement the mapValue() method to map a value on the scale to the logical position.

Returns:
double represent the logical position of this value.

mapValue

public abstract double mapValue(Object val)
Map a value to a logical position using this scale.

Returns:
double represent the logical position of this value.

init

public abstract void init(DataSet data)
Initialize the scale to use the values in the chartLens.

Parameters:
data - is chart data table.

getScaleOption

public int getScaleOption()
Get the scale initialization option, e.g. Scale.TICKS | Scale.ZERO.


setScaleOption

public void setScaleOption(int option)
Set the scale initialization option, e.g. Scale.TICKS | Scale.ZERO.


getMin

public abstract double getMin()
Get the min value on the scale.

Returns:
the min value of the scale in logical coordinate.

getMax

public abstract double getMax()
Get the max value on the scale.

Returns:
the max value of the scale in logical coordinate.

getTicks

public abstract double[] getTicks()
Get the tick positions. The values of the ticks are logical coordinate position same as the values returned by map().

Returns:
double[] represent the logical position of each tick.

getValues

public abstract Object[] getValues()
Get the values at each tick.

Returns:
Object[] represent values on each tick.

getFields

public String[] getFields()
Get the columns this scale is used to measure.


setFields

public void setFields(String[] fields)
Set the columns this scale is used to measure.


getDataFields

public String[] getDataFields()
Get the columns this scale is initialized from.


setDataFields

public void setDataFields(String[] fields)
Set the columns this scale is initialized from. This may contain a subset of columns of the fields this scale is used to measure.


setAxisSpec

public void setAxisSpec(AxisSpec axisSpec)
Set the attribute for creating the axis for this scale.


getAxisSpec

public AxisSpec getAxisSpec()
Get the associated axis attributes.


add

public double add(double v1,
                  double v2)
Add two mapped values to get the total value.

Parameters:
v1 - the specified mapped value a.
v2 - the specified mapped value b.
Returns:
the new total value.

getUnitCount

public int getUnitCount()
Get the number of units if the space is divided into partitions. This is used to calculate the size of shape (e.g. bar) for each data point.


clone

public Object clone()
Clone this object.

Overrides:
clone in class Object

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class Object

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object

hashCode

public int hashCode()
Get the hash code value.

Overrides:
hashCode in class Object

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.