ReportMill 7.0 API

com.reportmill.shape
Class RMGraph

java.lang.Object
  extended bycom.reportmill.foundation.RMObject
      extended bycom.reportmill.shape.RMShape
          extended bycom.reportmill.shape.RMGraph
All Implemented Interfaces:
java.lang.Cloneable, com.reportmill.foundation.RMArchiver.Archiving

public class RMGraph
extends RMShape

The RMGraph class provides a template and the machinery for generating graphs. It primarily encapsulates a list key for defining the set of objects to graph and a keys string for defining the attributes of those objects to graph. For instance, the list key might be "Movies" and the keys string might be "revenue". You can programatically create a graph like this:

  RMGraph graph = new RMGraph();
  graph.setBounds(0, 0, 640, 480);
  graph.setListKey("Movies");
  graph.setKeysString("revenue");
  graph.setType(RMGraph.TYPE_PIE);
  


Nested Class Summary
static class RMGraph.BarLabel
           
static class RMGraph.Content
           
static class RMGraph.Legend
           
 
Field Summary
static java.lang.String EXTRUDE_ALL
           
static java.lang.String EXTRUDE_CUSTOM
           
static java.lang.String EXTRUDE_FIRST
           
static java.lang.String EXTRUDE_LAST
           
static java.lang.String EXTRUDE_NONE
           
static java.lang.String[] EXTRUSIONS
           
static java.lang.String TYPE_BAR
           
static java.lang.String TYPE_BAR_HORIZONTAL
           
static java.lang.String TYPE_PIE
           
static java.lang.String[] TYPES
           
 
Fields inherited from class com.reportmill.shape.RMShape
HandleMaxXMaxY, HandleMaxXMidY, HandleMaxXMinY, HandleMidXMaxY, HandleMidXMinY, HandleMinXMaxY, HandleMinXMidY, HandleMinXMinY, HandleWidth
 
Constructor Summary
RMGraph()
          Creates a plain graph shape.
 
Method Summary
 boolean acceptsChildren()
          Editor method.
 boolean acceptsFormat()
          RMEditor method (indicates that graphs have settable format).
 boolean canBeUngrouped()
          Editor method.
 void copy(com.reportmill.foundation.RMObject anObj)
          Copies applicable attributes from the given object.
 boolean equals(java.lang.Object anObj)
          Standard implementation of Object equals.
 java.lang.Object fromXML(com.ribs.RXArchiver anArchiver, com.ribs.RXElement anElement)
          XML Unarchival.
 java.lang.String getAxisMinMaxCount()
          Returns the value axis' min, max and number of increments as a single string.
 RMGraph.BarLabel getBarLabel()
          Returns the child of the graph that represents bar labels (if present).
 float getBarSpacing()
          Returns the width of the space between bars as a ratio of the bar width (0.0 - 1.0).
 RMShape getBarWedgePrototype()
          Returns the shape used to represent the basic attributes of bars & wedges.
 float getBarWidth()
          Returns the width of the area used to draw bars as a ratio of the over-all area (0.0 - 1.0).
 java.util.List getColors()
          Returns the list of colors to be used by this graph (or the default graph colors, if null).
 RMGraph.Content getContent()
          Returns the shape that represents the conent of the graph.
static java.util.List getDefaultColors()
          Returns the default list of colors to be used by any graph without an explicit list of colors.
 boolean getDraw3D()
          Returns whether the graph draws in 3D.
 boolean getDrawAxisLabels()
          Returns whether the graph draws axis labels.
 boolean getDrawColor()
          Returns whether the graph draws in color.
 boolean getDrawGroupSeparator()
          Returns whether the graph draws a line between groups (if multiple keys).
 boolean getDrawMajorAxis()
          Returns whether the graph draws the major axis.
 boolean getDrawMinorAxis()
          Returns whether the graph draws the minor axis.
 boolean getDrawWedgeLabelLines()
          Returns whether a pie graph draws lines from the wedges to wedge labels.
 java.lang.String getExtrusionKey()
          Returns the key used to determine which pie wedges get extruded.
 RMFont getFont()
          Returns the font associated with the graph.
 RMFormat getFormat()
          Returns the format associated with the value axis of the graph.
 java.lang.String getGraphTypeString()
          Returns the graph type as a simple string: bar, pie or hbar.
 java.util.List getKeys()
          Returns a list of the individual keys in the (potentialy) comma separated keys string.
 java.lang.String getKeysString()
          Returns the keys string - a comma separated list of keys that the graph evaluates on the list key objects and represents in the graph.
 RMGraph.Legend getLegend()
          Returns the child of the graph that represents the legend (if present).
 java.lang.String getListKey()
          Returns the list key associated with the graph.
 boolean getShowBarLabels()
          Returns whether the graph shows bar labels.
 boolean getShowLegend()
          Returns whether the graph shows a legend.
 RMSort getSort(int anIdex)
          Returns the individual RMSort at the given index.
 int getSortCount()
          Returns the number of sorts associated with this graph.
 java.util.List getSorts()
          Returns the list of sorts associated with the graph.
 boolean getStacked()
          Returns whether multiple keys are stacked or separated.
 boolean getSwapSeries()
          Returns whether the graph groups bars by keys (normal) or by objects (swapped).
 int getTopNCount()
          Returns the top-n count for this graph's top-n sort.
 boolean getTopNIncludeOthers()
          Returns whether the top-n sort for this graph includes remainders.
 RMSort getTopNSort()
          Returns the top-n sort for this graph.
 java.lang.String getType()
          Returns the graph type (TYPE_BAR, TYPE_PIE, etc.).
 java.lang.Object initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
          Legacy unarchival.
 RMShape rpgClone(com.reportmill.foundation.ReportMill reportMill)
          A clone implementation that copies this shape and its children, performing data substituion as well.
 void setAxisMinMaxCount(java.lang.String aValue)
          Sets the value axis' min, max and number of increments as a single string.
 void setBarSpacing(float aValue)
          Sets the width of the space between bars as a ratio of the bar width (0.0 - 1.0).
 void setBarWedgePrototype(RMShape aShape)
          Sets the shape used to represent the basic attributes of bars & wedges.
 void setBarWidth(float aValue)
          Sets the width of the area used to draw bars as a ratio of the over-all area (0.0 - 1.0).
 void setColors(java.util.List aList)
          Sets the list of colors to be used by this graph.
static void setDefaultColors(java.util.List aList)
          Sets the default list of colors to be used by any graph without an explicit list of colors.
 void setDraw3D(boolean aFlag)
          Sets whether the graph draws in 3D.
 void setDrawAxisLabels(boolean aFlag)
          Sets whether the graph draws axis labels.
 void setDrawColor(boolean aFlag)
          Sets whether the graph draws in color.
 void setDrawGroupSeparator(boolean aFlag)
          Sets whether the graph draws a line between groups (if multiple keys).
 void setDrawMajorAxis(boolean aFlag)
          Sets whether the graph draws the major axis.
 void setDrawMinorAxis(boolean aFlag)
          Sets whether the graph draws the minor axis.
 void setDrawWedgeLabelLines(boolean aFlag)
          Sets whether a pie graph draws lines from the wedges to wedge labels.
 void setExtrusionKey(java.lang.String aKey)
          Sets the key used to determine which pie wedges get extruded.
 void setFont(RMFont aFont)
          Sets the font associated with the graph.
 void setFormat(RMFormat f)
          Sets the format associated with the value axis of the graph.
 void setGraphTypeString(java.lang.String aString)
          Sets the graph type as a simple string: bar, pie or hbar.
 void setKeysString(java.lang.String aString)
          Sets the keys string.
 void setListKey(java.lang.String aKeyPath)
          Sets the list key associated with the graph.
 void setShowBarLabels(boolean aFlag)
          Sets whether the graph shows bar labels.
 void setShowLegend(boolean aFlag)
          Sets whether the graph shows a legend.
 void setStacked(boolean aFlag)
          Sets whether multiple keys are stacked or separated.
 void setSwapSeries(boolean aFlag)
          Sets whether the graph groups bars by keys (normal) or by objects (swapped).
 void setTopNCount(int aCount)
          Sets the top-n count for this graph's top-n sort.
 void setTopNIncludeOthers(boolean aFlag)
          Sets whether the top-n sort for this graph includes remainders.
 void setTopNSort(RMSort aSO)
          Sets the top-n sort for this graph.
 void setType(java.lang.String aType)
          Sets the graph type (TYPE_BAR, TYPE_PIE, etc.).
 boolean superSelectable()
          Editor method.
 com.ribs.RXElement toXML(com.ribs.RXArchiver anArchiver)
          XML archival.
 
Methods inherited from class com.reportmill.shape.RMShape
acceptsDragKeys, acceptsEvents, acceptsFirstEvent, addChild, addChild, addChildBelowLastChild, boundsChanged, boundsChanged, bringShapesToFront, childHitByPoint, childrenHitByPath, childrenSuperSelectImmediately, clone, cloneDeep, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertedSizeFromShape, convertedSizeToShape, convertedVectorFromShape, convertedVectorToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertSizeFromShape, convertSizeToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, didChange, divideShapeFromEdge, divideShapeFromTop, dragExit, dragKeyAtPoint, drawChildren, drawsFill, drawsStroke, dropKeyAtPoint, fromXMLDeep, get, getActionScript, getAnim, getAnim, getAnimator, getAnimator, getAutosizeHeight, getAutosizing, getBounds, getBounds, getBoundsInside, getBoundsMarked, getBoundsOfChildren, getBoundsOfChildren, getBoundsOfPath, getBoundsOrigin, getBoundsSize, getBoundsSuperSelected, getChild, getChildAnimator, getChildAnimator, getChildCount, getChildLast, getChildren, getChildWithClass, getChildWithName, getColor, getCommonAncestor, getDocument, getFill, getGroupShape, getHeight, getHeightToFit, getImageData, getImageFill, getLineWidth, getListKeyDeep, getListKeyShape, getName, getOpacity, getOpacityDeep, getOrigin, getOutline, getPageCount, getPageShape, getParent, getParentCount, getParents, getPath, getPathInBounds, getRoll, getRootShape, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSkewX, getSkewY, getStroke, getStrokeColor, getTextColor, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getUrl, getWidth, getWidthToFit, getX, getY, groupShapes, handleAtPoint, handleCount, handlePoint, handleRect, hasPageBreaks, height, hitByPath, hitByPoint, hitChildren, indexOf, indexOf, isAncestor, isDescendant, isLocked, isRoot, isUnderlined, maxX, maxXInside, maxY, maxYInside, midX, midXInside, midY, midYInside, minX, minXInside, minY, minYInside, moveHandleToPoint, notRSS, offsetChildrenXY, offsetXY, opposingHandle, page, pageBreakMax, pageBreakPageMax, pageMax, put, reclaimChildren, removeChild, removeChild, removeChildren, removeChildren, removeFromParent, resolvePageReferences, rpgCloneBase, rpgCloneChildren, rpgCloneConclude, rpgCloneNotification, rpgClonePrepare, rpgClonePreprocess, rpgCloneUrl, sendShapesToBack, setActionScript, setAnim, setAutosizeHeight, setAutosizing, setBounds, setBounds, setBoundsOrigin, setBoundsOrigin, setBoundsOriginX, setBoundsOriginY, setBoundsSize, setBoundsSize, setChildAnimator, setChildren, setColor, setColor, setDrawsFill, setDrawsStroke, setEverythingStretches, setFill, setFill, setHeight, setHeightDeep, setHeightDeep, setHeightToFit, setLineWidth, setLocked, setName, setNeedsRepaint, setNeedsRepaint, setOnlyBottomAndRightMarginStretches, setOnlyTopAndRightMarginStretches, setOnlyWidthAndHeightStretches, setOpacity, setOrigin, setOrigin, setOutline, setParent, setRoll, setScaleX, setScaleXY, setScaleXY, setScaleY, setSize, setSize, setSizeDeep, setSizeDeep, setSizeToFit, setSizeToFit, setSkewX, setSkewXY, setSkewXY, setSkewY, setStroke, setStroke, setStrokeColor, setStrokeColor, setTextColor, setTime, setUnderlined, setUrl, setWidth, setWidthDeep, setWidthDeep, setWidthToFit, setX, setXY, setXY, setXYWidthHeight, setY, sizesToFitChildren, superSelectImmediately, toString, undoClone, undoCopy, undoEquals, undoerAddDirtyObject, undoerDisable, undoerEnable, undoerSetUndoTitle, width, willChange, willChange, x, y
 
Methods inherited from class com.reportmill.foundation.RMObject
archiverClassName, didUndo, getAnimAttribute, getClassNameShort
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_BAR

public static final java.lang.String TYPE_BAR
See Also:
Constant Field Values

TYPE_BAR_HORIZONTAL

public static final java.lang.String TYPE_BAR_HORIZONTAL
See Also:
Constant Field Values

TYPE_PIE

public static final java.lang.String TYPE_PIE
See Also:
Constant Field Values

TYPES

public static final java.lang.String[] TYPES

EXTRUDE_NONE

public static final java.lang.String EXTRUDE_NONE
See Also:
Constant Field Values

EXTRUDE_FIRST

public static final java.lang.String EXTRUDE_FIRST
See Also:
Constant Field Values

EXTRUDE_LAST

public static final java.lang.String EXTRUDE_LAST
See Also:
Constant Field Values

EXTRUDE_ALL

public static final java.lang.String EXTRUDE_ALL
See Also:
Constant Field Values

EXTRUDE_CUSTOM

public static final java.lang.String EXTRUDE_CUSTOM
See Also:
Constant Field Values

EXTRUSIONS

public static final java.lang.String[] EXTRUSIONS
Constructor Detail

RMGraph

public RMGraph()
Creates a plain graph shape.

Method Detail

getListKey

public java.lang.String getListKey()
Returns the list key associated with the graph.

Overrides:
getListKey in class RMShape

setListKey

public void setListKey(java.lang.String aKeyPath)
Sets the list key associated with the graph.

Overrides:
setListKey in class RMShape

getKeysString

public java.lang.String getKeysString()
Returns the keys string - a comma separated list of keys that the graph evaluates on the list key objects and represents in the graph.


setKeysString

public void setKeysString(java.lang.String aString)
Sets the keys string.


getKeys

public java.util.List getKeys()
Returns a list of the individual keys in the (potentialy) comma separated keys string.


getType

public java.lang.String getType()
Returns the graph type (TYPE_BAR, TYPE_PIE, etc.).


setType

public void setType(java.lang.String aType)
Sets the graph type (TYPE_BAR, TYPE_PIE, etc.).


getGraphTypeString

public java.lang.String getGraphTypeString()
Returns the graph type as a simple string: bar, pie or hbar.


setGraphTypeString

public void setGraphTypeString(java.lang.String aString)
Sets the graph type as a simple string: bar, pie or hbar.


getSortCount

public int getSortCount()
Returns the number of sorts associated with this graph.


getSort

public RMSort getSort(int anIdex)
Returns the individual RMSort at the given index.


getSorts

public java.util.List getSorts()
Returns the list of sorts associated with the graph.


getTopNSort

public RMSort getTopNSort()
Returns the top-n sort for this graph.


setTopNSort

public void setTopNSort(RMSort aSO)
Sets the top-n sort for this graph.


getTopNCount

public int getTopNCount()
Returns the top-n count for this graph's top-n sort.


setTopNCount

public void setTopNCount(int aCount)
Sets the top-n count for this graph's top-n sort.


getTopNIncludeOthers

public boolean getTopNIncludeOthers()
Returns whether the top-n sort for this graph includes remainders.


setTopNIncludeOthers

public void setTopNIncludeOthers(boolean aFlag)
Sets whether the top-n sort for this graph includes remainders.


getDrawColor

public boolean getDrawColor()
Returns whether the graph draws in color.


setDrawColor

public void setDrawColor(boolean aFlag)
Sets whether the graph draws in color.


getDraw3D

public boolean getDraw3D()
Returns whether the graph draws in 3D.


setDraw3D

public void setDraw3D(boolean aFlag)
Sets whether the graph draws in 3D.


getSwapSeries

public boolean getSwapSeries()
Returns whether the graph groups bars by keys (normal) or by objects (swapped).


setSwapSeries

public void setSwapSeries(boolean aFlag)
Sets whether the graph groups bars by keys (normal) or by objects (swapped).


getStacked

public boolean getStacked()
Returns whether multiple keys are stacked or separated.


setStacked

public void setStacked(boolean aFlag)
Sets whether multiple keys are stacked or separated.


getDrawAxisLabels

public boolean getDrawAxisLabels()
Returns whether the graph draws axis labels.


setDrawAxisLabels

public void setDrawAxisLabels(boolean aFlag)
Sets whether the graph draws axis labels.


getDrawMajorAxis

public boolean getDrawMajorAxis()
Returns whether the graph draws the major axis.


setDrawMajorAxis

public void setDrawMajorAxis(boolean aFlag)
Sets whether the graph draws the major axis.


getDrawMinorAxis

public boolean getDrawMinorAxis()
Returns whether the graph draws the minor axis.


setDrawMinorAxis

public void setDrawMinorAxis(boolean aFlag)
Sets whether the graph draws the minor axis.


getDrawGroupSeparator

public boolean getDrawGroupSeparator()
Returns whether the graph draws a line between groups (if multiple keys).


setDrawGroupSeparator

public void setDrawGroupSeparator(boolean aFlag)
Sets whether the graph draws a line between groups (if multiple keys).


getBarWidth

public float getBarWidth()
Returns the width of the area used to draw bars as a ratio of the over-all area (0.0 - 1.0).


setBarWidth

public void setBarWidth(float aValue)
Sets the width of the area used to draw bars as a ratio of the over-all area (0.0 - 1.0).


getBarSpacing

public float getBarSpacing()
Returns the width of the space between bars as a ratio of the bar width (0.0 - 1.0).


setBarSpacing

public void setBarSpacing(float aValue)
Sets the width of the space between bars as a ratio of the bar width (0.0 - 1.0).


getAxisMinMaxCount

public java.lang.String getAxisMinMaxCount()
Returns the value axis' min, max and number of increments as a single string.


setAxisMinMaxCount

public void setAxisMinMaxCount(java.lang.String aValue)
Sets the value axis' min, max and number of increments as a single string.


getDrawWedgeLabelLines

public boolean getDrawWedgeLabelLines()
Returns whether a pie graph draws lines from the wedges to wedge labels.


setDrawWedgeLabelLines

public void setDrawWedgeLabelLines(boolean aFlag)
Sets whether a pie graph draws lines from the wedges to wedge labels.


getExtrusionKey

public java.lang.String getExtrusionKey()
Returns the key used to determine which pie wedges get extruded.


setExtrusionKey

public void setExtrusionKey(java.lang.String aKey)
Sets the key used to determine which pie wedges get extruded.


getBarLabel

public RMGraph.BarLabel getBarLabel()
Returns the child of the graph that represents bar labels (if present).


getShowBarLabels

public boolean getShowBarLabels()
Returns whether the graph shows bar labels.


setShowBarLabels

public void setShowBarLabels(boolean aFlag)
Sets whether the graph shows bar labels.


getLegend

public RMGraph.Legend getLegend()
Returns the child of the graph that represents the legend (if present).


getShowLegend

public boolean getShowLegend()
Returns whether the graph shows a legend.


setShowLegend

public void setShowLegend(boolean aFlag)
Sets whether the graph shows a legend.


getColors

public java.util.List getColors()
Returns the list of colors to be used by this graph (or the default graph colors, if null).


setColors

public void setColors(java.util.List aList)
Sets the list of colors to be used by this graph.


getDefaultColors

public static java.util.List getDefaultColors()
Returns the default list of colors to be used by any graph without an explicit list of colors.


setDefaultColors

public static void setDefaultColors(java.util.List aList)
Sets the default list of colors to be used by any graph without an explicit list of colors.


getFont

public RMFont getFont()
Returns the font associated with the graph.

Overrides:
getFont in class RMShape

setFont

public void setFont(RMFont aFont)
Sets the font associated with the graph.

Overrides:
setFont in class RMShape

getFormat

public RMFormat getFormat()
Returns the format associated with the value axis of the graph.

Overrides:
getFormat in class RMShape

setFormat

public void setFormat(RMFormat f)
Sets the format associated with the value axis of the graph.

Overrides:
setFormat in class RMShape

acceptsFormat

public boolean acceptsFormat()
RMEditor method (indicates that graphs have settable format).

Overrides:
acceptsFormat in class RMShape

getBarWedgePrototype

public RMShape getBarWedgePrototype()
Returns the shape used to represent the basic attributes of bars & wedges.


setBarWedgePrototype

public void setBarWedgePrototype(RMShape aShape)
Sets the shape used to represent the basic attributes of bars & wedges.


getContent

public RMGraph.Content getContent()
Returns the shape that represents the conent of the graph.


equals

public boolean equals(java.lang.Object anObj)
Description copied from class: RMShape
Standard implementation of Object equals.

Overrides:
equals in class RMShape

copy

public void copy(com.reportmill.foundation.RMObject anObj)
Description copied from class: RMShape
Copies applicable attributes from the given object.

Overrides:
copy in class RMShape

initWithArchiver

public java.lang.Object initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
Legacy unarchival.

Specified by:
initWithArchiver in interface com.reportmill.foundation.RMArchiver.Archiving
Overrides:
initWithArchiver in class RMShape

toXML

public com.ribs.RXElement toXML(com.ribs.RXArchiver anArchiver)
XML archival.

Overrides:
toXML in class RMShape

fromXML

public java.lang.Object fromXML(com.ribs.RXArchiver anArchiver,
                                com.ribs.RXElement anElement)
XML Unarchival.

Overrides:
fromXML in class RMShape

superSelectable

public boolean superSelectable()
Description copied from class: RMShape
Editor method.

Overrides:
superSelectable in class RMShape

canBeUngrouped

public boolean canBeUngrouped()
Description copied from class: RMShape
Editor method.

Overrides:
canBeUngrouped in class RMShape

acceptsChildren

public boolean acceptsChildren()
Description copied from class: RMShape
Editor method.

Overrides:
acceptsChildren in class RMShape

rpgClone

public RMShape rpgClone(com.reportmill.foundation.ReportMill reportMill)
Description copied from class: RMShape
A clone implementation that copies this shape and its children, performing data substituion as well.

Overrides:
rpgClone in class RMShape

ReportMill 7.0 API