prefuse.action.layout
Class AxisLayout

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.GroupAction
              extended by prefuse.action.layout.Layout
                  extended by prefuse.action.layout.AxisLayout

public class AxisLayout
extends Layout

Layout Action that assigns positions along a single dimension (either x or y) according to a specified data field. By default, the range of values along the axis is automatically determined by the minimum and maximum values of the data field. The range bounds can be manually set using the setRangeModel(ValuedRangeModel) method. Also, the set of items processed by this layout can be filtered by providing a filtering predicate (@link #setFilter(Predicate)).

Author:
jeffrey heer

Field Summary
 
Fields inherited from class prefuse.action.layout.Layout
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, m_tmpb
 
Fields inherited from class prefuse.action.GroupAction
m_group
 
Fields inherited from class prefuse.action.Action
m_vis
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
AxisLayout(java.lang.String group, java.lang.String field)
          Create a new AxisLayout.
AxisLayout(java.lang.String group, java.lang.String field, Axis axis)
          Create a new AxisLayout.
AxisLayout(java.lang.String group, java.lang.String field, Axis axis, Predicate filter)
          Create a new AxisLayout.
 
Method Summary
 Axis getAxis()
          Return the axis type of this layout
 java.lang.String getDataField()
          Get the data field used by this axis layout action.
 DataType getDataType()
          Return the data type used by this layout.
protected  DataType getDataType(TupleSet<? extends VisualItem<?>> ts)
          Retrieve the data type.
 Predicate getFilter()
          Get the predicate filter to limit which items are considered for layout.
 ValuedRangeModel getRangeModel()
          Get the range model determing the span of the axis.
 Scale getScale()
          Returns the scale type used for the axis.
protected  void numericalLayout(TupleSet<? extends VisualItem<?>> ts)
          Compute a quantitative axis layout.
protected  void ordinalLayout(TupleSet<? extends VisualItem<?>> ts)
          Compute an ordinal axis layout.
 void run(double frac)
          Runs this Action, triggering whatever processing this Action performs.
protected  void set(VisualItem<?> item, double frac)
          Set the layout position of an item.
 void setAxis(Axis axis)
          Set the axis type of this layout.
 void setDataField(java.lang.String field)
          Set the data field used by this axis layout action.
 void setDataType(DataType type)
          Set the data type used by this layout.
 void setFilter(Predicate filter)
          Set a predicate filter to limit which items are considered for layout.
 void setRangeModel(ValuedRangeModel model)
          Set the range model determing the span of the axis.
 void setScale(Scale scale)
          Sets the scale type used for the axis.
 
Methods inherited from class prefuse.action.layout.Layout
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
 
Methods inherited from class prefuse.action.GroupAction
getGroup, setGroup
 
Methods inherited from class prefuse.action.Action
getVisualization, run, setVisualization
 
Methods inherited from class prefuse.activity.Activity
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisLayout

public AxisLayout(java.lang.String group,
                  java.lang.String field)
Create a new AxisLayout. Defaults to using the x-axis.

Parameters:
group - the data group to layout
field - the data field upon which to base the layout

AxisLayout

public AxisLayout(java.lang.String group,
                  java.lang.String field,
                  Axis axis)
Create a new AxisLayout.

Parameters:
group - the data group to layout
field - the data field upon which to base the layout
axis - the axis type

AxisLayout

public AxisLayout(java.lang.String group,
                  java.lang.String field,
                  Axis axis,
                  Predicate filter)
Create a new AxisLayout.

Parameters:
group - the data group to layout
field - the data field upon which to base the layout
axis - the axis type
filter - an optional predicate filter for limiting which items to layout.
Method Detail

setDataField

public void setDataField(java.lang.String field)
Set the data field used by this axis layout action. The values of the data field will determine the position of items along the axis. Note that this method does not affect the other parameters of this action. In particular, clients that have provided a custom range model for setting the axis range may need to appropriately update the model setting for use with the new data field setting.

Parameters:
field - the name of the data field that determines the layout

getDataField

public java.lang.String getDataField()
Get the data field used by this axis layout action. The values of the data field determine the position of items along the axis.

Returns:
the name of the data field that determines the layout

setRangeModel

public void setRangeModel(ValuedRangeModel model)
Set the range model determing the span of the axis. This model controls the minimum and maximum values of the layout, as provided by the ValuedRangeModel.getLowValue() and ValuedRangeModel.getHighValue() methods.

Parameters:
model - the range model for the axis.

getRangeModel

public ValuedRangeModel getRangeModel()
Get the range model determing the span of the axis. This model controls the minimum and maximum values of the layout, as provided by the ValuedRangeModel.getLowValue() and ValuedRangeModel.getHighValue() methods.

Returns:
the range model for the axis.

setFilter

public void setFilter(Predicate filter)
Set a predicate filter to limit which items are considered for layout. Only items for which the predicate returns a true value are included in the layout computation.

Parameters:
filter - the predicate filter to use. If null, no filtering will be performed.

getFilter

public Predicate getFilter()
Get the predicate filter to limit which items are considered for layout. Only items for which the predicate returns a true value are included in the layout computation.

Returns:
the predicate filter used by this layout. If null, no filtering is performed.

getScale

public Scale getScale()
Returns the scale type used for the axis. This setting only applies for numerical data types (i.e., when axis values are from a NumberValuedRange).

Returns:
the scale type

setScale

public void setScale(Scale scale)
Sets the scale type used for the axis. This setting only applies for numerical data types (i.e., when axis values are from a NumberValuedRange).

Parameters:
scale - the scale type

getAxis

public Axis getAxis()
Return the axis type of this layout

Returns:
the axis type of this layout.

setAxis

public void setAxis(Axis axis)
Set the axis type of this layout.

Parameters:
axis - the axis type to use for this layout

getDataType

public DataType getDataType()
Return the data type used by this layout.

Returns:
the data type used by this layout

setDataType

public void setDataType(DataType type)
Set the data type used by this layout.

Parameters:
type - the data type used by this layout

run

public void run(double frac)
Description copied from class: Action
Runs this Action, triggering whatever processing this Action performs. Subclass this method to create custom Actions.

Specified by:
run in class GroupAction
Parameters:
frac - the fraction of this Action's duration that has elapsed.
See Also:
Action.run(double)

getDataType

protected DataType getDataType(TupleSet<? extends VisualItem<?>> ts)
Retrieve the data type.


set

protected void set(VisualItem<?> item,
                   double frac)
Set the layout position of an item.


numericalLayout

protected void numericalLayout(TupleSet<? extends VisualItem<?>> ts)
Compute a quantitative axis layout.


ordinalLayout

protected void ordinalLayout(TupleSet<? extends VisualItem<?>> ts)
Compute an ordinal axis layout.



Copyright © 2008 Regents of the University of California