JMSLTM Numerical Library 6.0

com.imsl.chart
Class Treemap

java.lang.Object
  extended by com.imsl.chart.AbstractChartNode
      extended by com.imsl.chart.ChartNode
          extended by com.imsl.chart.Data
              extended by com.imsl.chart.Treemap
All Implemented Interfaces:
Serializable, Cloneable

public class Treemap
extends Data

Treemap creates a chart from two arrays of double precision values or one data array and one array of Color values. The size of each element is scaled using the first input array. The second array of values or colors is used to shade the corresponding area.

The algorithm is adapted from Bruls, Mark and Huizing, Kees and Wijk, Jarke J. van (2000) Squarified Treemaps. In Proceedings of the Joint Eurographics and IEEE TCVG Symposium on Visualization.

See Also:
Colormap, Example1, Example2, Chart Programmer's Guide: Treemap, Serialized Form

Nested Class Summary
 class Treemap.Legend
          A legend for use with a treemap.
 
Field Summary
static int AUTOMATIC
          Flag to set the treemap orientation automatically.
static int COLUMNFIRST
          Flag to set the treemap orientation drawing columns first.
static int ROWFIRST
          Flag to set the treemap orientation drawing rows first.
 
Fields inherited from class com.imsl.chart.ChartNode
AXIS_X_TOP, AXIS_Y_RIGHT, BAR_TYPE_HORIZONTAL, BAR_TYPE_VERTICAL, DASH_PATTERN_DASH, DASH_PATTERN_DASH_DOT, DASH_PATTERN_DOT, DASH_PATTERN_SOLID, DATA_TYPE_FILL, DATA_TYPE_LINE, DATA_TYPE_MARKER, DATA_TYPE_PICTURE, DATA_TYPE_TUBE, DENDROGRAM_TYPE_HORIZONTAL, DENDROGRAM_TYPE_VERTICAL, FILL_TYPE_GRADIENT, FILL_TYPE_NONE, FILL_TYPE_PAINT, FILL_TYPE_SOLID, LABEL_TYPE_PERCENT, MARKER_TYPE_ASTERISK, MARKER_TYPE_CIRCLE_CIRCLE, MARKER_TYPE_CIRCLE_PLUS, MARKER_TYPE_CIRCLE_X, MARKER_TYPE_DIAMOND_PLUS, MARKER_TYPE_FILLED_CIRCLE, MARKER_TYPE_FILLED_DIAMOND, MARKER_TYPE_FILLED_SQUARE, MARKER_TYPE_FILLED_TRIANGLE, MARKER_TYPE_HOLLOW_CIRCLE, MARKER_TYPE_HOLLOW_DIAMOND, MARKER_TYPE_HOLLOW_SQUARE, MARKER_TYPE_HOLLOW_TRIANGLE, MARKER_TYPE_OCTAGON_PLUS, MARKER_TYPE_OCTAGON_X, MARKER_TYPE_PLUS, MARKER_TYPE_SQUARE_PLUS, MARKER_TYPE_SQUARE_X, MARKER_TYPE_X, TEXT_X_CENTER, TEXT_X_LEFT, TEXT_X_RIGHT, TEXT_Y_BOTTOM, TEXT_Y_CENTER, TEXT_Y_TOP
 
Fields inherited from class com.imsl.chart.AbstractChartNode
AUTOSCALE_DATA, AUTOSCALE_DENSITY, AUTOSCALE_NUMBER, AUTOSCALE_OFF, AUTOSCALE_WINDOW, AXIS_X, AXIS_Y, AXIS_Z, LABEL_TYPE_NONE, LABEL_TYPE_TITLE, LABEL_TYPE_X, LABEL_TYPE_Y, LABEL_TYPE_Z, TRANSFORM_CUSTOM, TRANSFORM_LINEAR, TRANSFORM_LOG
 
Constructor Summary
Treemap(AxisXY axis, double[] data, Color[] colors)
          Constructs a treemap using supplied data and colors array.
Treemap(AxisXY axis, double[] data, double[] shades, Colormap colormap)
          Constructs a treemap using supplied data and a colormap.
 
Method Summary
 void dataRange(double[] range)
          Updates the data range, range = {xmin,xmax,ymin,ymax} or range = {xmin,xmax,ymin,ymax,zmin,zmax}.
 Colormap getColormap()
          Returns the value of the "Colormap" attribute.
 Text[] getLabels()
          Returns the value of the "TreemapLabels" attribute.
 int getOrientation()
          Gets the value of the "Orientation" attribute.
 Treemap.Legend getTreemapLegend()
          Returns the treemap legend.
 void paint(Draw draw)
          Paints this node and all of its children.
 void setAxisRange(double[] range)
          Set the axis range, range = {xmin,xmax,ymin,ymax}.
 void setColormap(Colormap colorMap)
          Sets the value of the "Colormap" attribute.
 void setLabels(String[] labels)
          Sets the value of the "TreemapLabels" attribute.
 void setLabels(Text[] labels)
          Sets the value of the "TreemapLabels" attribute.
 void setOrientation(int value)
          Sets the value of the "Orientation" attribute.
 void setZRange(double[] range)
          Set the Z data (shading) range, range = {zmin,zmax}.
 
Methods inherited from class com.imsl.chart.Data
formatLabel
 
Methods inherited from class com.imsl.chart.ChartNode
addPickListener, firePickListeners, getALT, getAxis, getBackground, getBarGap, getBarType, getBarWidth, getChart, getChartTitle, getChildren, getClipData, getComponent, getConcatenatedViewport, getDataType, getDoubleBuffering, getExplode, getFillOutlineColor, getFillOutlineType, getFillPaint, getFillType, getGradient, getHREF, getLegend, getLineDashPattern, getMarkerDashPattern, getMarkerThickness, getMarkerType, getParent, getReference, getScreenAxis, getScreenSize, getScreenViewport, getSize, getSkipWeekends, getTextAngle, getTextColor, getTitle, getToolTip, getViewport, isBitSet, prePaint, removePickListener, setALT, setBarGap, setBarType, setBarWidth, setChartTitle, setClipData, setCustomTransform, setDataType, setDoubleBuffering, setExplode, setFillOutlineColor, setFillOutlineColor, setFillOutlineType, setFillPaint, setFillPaint, setFillPaint, setFillType, setGradient, setGradient, setGradient, setHREF, setImage, setLineDashPattern, setMarkerDashPattern, setMarkerThickness, setMarkerType, setReference, setScreenSize, setSize, setSkipWeekends, setTextAngle, setTextColor, setTextColor, setTitle, setTitle, setToolTip, setViewport, setViewport
 
Methods inherited from class com.imsl.chart.AbstractChartNode
clone, clone, clone, clone, getAbstractParent, getAttribute, getAutoscaleInput, getAutoscaleMinimumTimeInterval, getAutoscaleOutput, getBooleanAttribute, getChildList, getColorAttribute, getCustomTransform, getDensity, getDoubleAttribute, getFillColor, getFont, getFontName, getFontSize, getFontStyle, getImage, getIntegerAttribute, getLabelType, getLightColor, getLineColor, getLineWidth, getLocale, getMarkerColor, getMarkerSize, getName, getNumber, getPaint, getStringAttribute, getTextFormat, getTickLength, getTransform, getX, getY, isAncestorOf, isAttributeSet, isAttributeSetAtThisNode, parseColor, remove, setAttribute, setAutoscaleInput, setAutoscaleMinimumTimeInterval, setAutoscaleOutput, setDensity, setFillColor, setFillColor, setFont, setFontName, setFontSize, setFontStyle, setImage, setLabelType, setLightColor, setLightColor, setLineColor, setLineColor, setLineWidth, setLocale, setMarkerColor, setMarkerColor, setMarkerSize, setName, setNumber, setPaint, setTextFormat, setTextFormat, setTickLength, setTransform, setX, setY, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTOMATIC

public static final int AUTOMATIC
Flag to set the treemap orientation automatically.

See Also:
Constant Field Values

COLUMNFIRST

public static final int COLUMNFIRST
Flag to set the treemap orientation drawing columns first.

See Also:
Constant Field Values

ROWFIRST

public static final int ROWFIRST
Flag to set the treemap orientation drawing rows first.

See Also:
Constant Field Values
Constructor Detail

Treemap

public Treemap(AxisXY axis,
               double[] data,
               Color[] colors)
Constructs a treemap using supplied data and colors array.

Parameters:
axis - the AxisXY parent of this node
data - the area values for the treemap in decreasing order
colors - an array of colors for each area

Treemap

public Treemap(AxisXY axis,
               double[] data,
               double[] shades,
               Colormap colormap)
Constructs a treemap using supplied data and a colormap.

Parameters:
axis - the AxisXY parent of this node
data - the area values for the treemap in decreasing order
shades - an array of values to use for shading each area
colormap - a Colormap to use for the shading
Method Detail

dataRange

public void dataRange(double[] range)
Updates the data range, range = {xmin,xmax,ymin,ymax} or range = {xmin,xmax,ymin,ymax,zmin,zmax}. The entries in the range are updated to reflect the extent of the data in this node. The argument range is an input/output variable. Its value should be updated only if the data in this node is outside the range already in the array. The third dimension is not required.

Default values are {0,100,0,100} for the data extents and the z range is comupted from the color data.

Overrides:
dataRange in class Data
Parameters:
range - a double array which contains the updated range, {xmin,xmax,ymin,ymax} or {xmin, xmax,ymin,ymax,zmin,zmax}

getColormap

public Colormap getColormap()
Returns the value of the "Colormap" attribute. This is the Colormap associated with this Treemap.

Returns:
The Colormap value of the "Colormap" attribute, if defined. Otherwise, null is returned.

getLabels

public Text[] getLabels()
Returns the value of the "TreemapLabels" attribute.

Returns:
An array of Text objects that are the value of the "TreemapLabels" attribute, if defined. Otherwise, null is returned.

getOrientation

public int getOrientation()
Gets the value of the "Orientation" attribute.

Returns:
One of AUTOMATIC, ROWFIRST or COLUMNFIRST. The default behavior is AUTOMATIC and filling the graph is based on the aspect ratio of the parent Axis object such that if the height is less than the width, columns are drawn first; otherwise rows are drawn first.
See Also:
AUTOMATIC, COLUMNFIRST, ROWFIRST

getTreemapLegend

public Treemap.Legend getTreemapLegend()
Returns the treemap legend.

By default, the legend is not drawn because its "Paint" attribute is set to false. To show the legend set "Paint" to true, .i.e., contour.getTreemapLegend().setPaint(true);

Returns:
The Legend object associated with the Treemap.

paint

public void paint(Draw draw)
Paints this node and all of its children. This is normally called only by the paint method in this node's parent.

Overrides:
paint in class Data
Parameters:
draw - the Draw object to be painted

setAxisRange

public void setAxisRange(double[] range)
Set the axis range, range = {xmin,xmax,ymin,ymax}. The default value is {0, 100, 0, 100}. In some cases the aspect ratio of the graph should be changed so as to result in an improved layout. Adjust this array to modify the layout in that manner. The actual values are not important, but the values should match the aspect ratio of the final chart for best results.

Parameters:
range - a double array which contains the data range, {xmin,xmax,ymin,ymax}

setColormap

public void setColormap(Colormap colorMap)
Sets the value of the "Colormap" attribute. This is the Colormap associated with this Treemap.

Parameters:
colorMap - The Colormap object's "ColorMap" value.

setLabels

public void setLabels(String[] labels)
Sets the value of the "TreemapLabels" attribute. The value of the "TreemapLabels" attribute is a two dimensional array of Text objects. Each Text object is created from the corresponding label value with TEXT_X_CENTER|TEXT_Y_CENTER alignment.

Parameters:
labels - An array of String objects used to create the array of Text objects that is the value of the attribute.
See Also:
Text

setLabels

public void setLabels(Text[] labels)
Sets the value of the "TreemapLabels" attribute.

Parameters:
labels - an array of Text objects that are used to set the "TreemapLabels" attribute.

setOrientation

public void setOrientation(int value)
Sets the value of the "Orientation" attribute.

Parameters:
value - One of AUTOMATIC, ROWFIRST, or COLUMNFIRST. The default behavior is AUTOMATIC and filling the graph is based on the aspect ratio of the parent Axis object such that if the height is less than the width, columns are drawn first; otherwise rows are drawn first.
See Also:
AUTOMATIC, COLUMNFIRST, ROWFIRST

setZRange

public void setZRange(double[] range)
Set the Z data (shading) range, range = {zmin,zmax}. The default value is computed from the input shades array or else is {0,1}.

Parameters:
range - a double array which contains the data range, {zmin,zmax}

JMSLTM Numerical Library 6.0

Copyright © 1970-2009 Visual Numerics, Inc.
Built September 1 2009.