Package com.reportmill.shape
Class RMGraph
java.lang.Object
com.reportmill.base.RMObject
com.reportmill.shape.RMShape
com.reportmill.shape.RMGraph
- All Implemented Interfaces:
RMArchiver.Archiving
,Cloneable
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
Nested ClassesModifier and TypeClassDescriptionstatic class
An inner class for bar labels.static class
An inner class for Legend. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String[]
static final String
static final String
static final String
static final String[]
Fields inherited from class com.reportmill.shape.RMShape
WRAP_TYPE_BOTH, WRAP_TYPE_NONE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Editor method indicates that graph can accept new children.boolean
RMEditor method (indicates that graphs have settable format).boolean
Editor method indicates that graph cannot be ungrouped.void
Copies the attributes from the given object into receiver (for undo).boolean
Standard equals implementation.fromXML
(RXArchiver anArchiver, RXElement anElement) XML unarchival.Returns the value axis' min, max and number of increments as a single string.Returns the child of the graph that represents bar labels (if present).float
Returns the width of the space between bars as a ratio of the bar width (0.0 - 1.0).Returns the shape used to represent the basic attributes of bars & wedges.float
Returns the width of the area used to draw bars as a ratio of the over-all area (0.0 - 1.0).getColor
(int anIndex) Returns the specific color at the given index.int
Returns the number of colors set for this graph.Returns the list of colors to be used by this graph (or the default graph colors, if null).Returns the shape that represents the conent of the graph.static List
Returns the default list of colors to be used by any graph without an explicit list of colors.boolean
Returns whether the graph draws in 3D.boolean
Returns whether the graph draws axis labels.boolean
Returns whether the graph draws a line between groups (if multiple keys).boolean
Returns whether the graph draws the major axis.boolean
Returns whether the graph draws the minor axis.boolean
Returns whether a pie graph draws lines from the wedges to wedge labels.Returns the key used to determine which pie wedges get extruded.Returns the optional key chain (expression) used to limit the table list derived from list key.getFont()
Returns the font associated with the graph.Returns the format associated with the value axis of the graph.Returns the graph type as a simple string: bar, pie or hbar.getKeys()
Returns a list of the individual keys in the (potentially) comma separated keys string.Returns keys string - a comma separated list of keys evaluated on list key objects to represent in graph.Returns the child of the graph that represents the legend (if present).Returns the list key associated with the graph.static RMShape
getSampleGraphContent
(RMGraphContent aGraphContent) Returns a filled graph content for a given graph content.boolean
Returns whether the graph shows bar labels.boolean
Returns whether the graph shows a legend.getSort
(int anIdex) Returns the individual RMSort at the given index.int
Returns the number of sorts associated with this graph.getSorts()
Returns the list of sorts associated with the graph.boolean
Returns whether multiple keys are stacked or separated.boolean
Returns whether the graph groups bars by keys (normal) or by objects (swapped).int
Returns the top-n count for this graph's top-n sort.boolean
Returns whether the top-n sort for this graph includes remainders.Returns the top-n sort for this graph.getType()
Returns the graph type (TYPE_BAR, TYPE_PIE, etc.).initWithArchiver
(RMArchiver anArchiver) Legacy unarchival.rpgClone
(ReportMill anRM) Returns a clone of this shape with report generation.void
setAxisMinMaxCount
(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
Sets the list of colors to be used by this graph.static void
setDefaultColors
(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
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
(String aKey) Sets the key used to determine which pie wedges get extruded.void
setFilterKey
(String aKeyExpr) Returns the optional key chain (expression) used to limit the table list derived from list key.void
Sets the font associated with the graph.void
Sets the format associated with the value axis of the graph.void
setGraphTypeString
(String aString) Sets the graph type as a simple string: bar, pie or hbar.void
setKeysString
(String aString) Sets keys string - a comma separated list of keys evaluated on list key objects to represent in graph.void
setListKey
(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
Sets the graph type (TYPE_BAR, TYPE_PIE, etc.).boolean
Editor method indicates that graph can be super selected.toXML
(RXArchiver anArchiver) XML archival.Methods inherited from class com.reportmill.shape.RMShape
acceptsDragKeys, acceptsMouse, addChild, addChild, addChildBelowLastChild, bounds, boundsChanged, boundsChanged, bringShapesToFront, childrenSuperSelectImmediately, clone, cloneDeep, contains, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertedSizeFromShape, convertedSizeToShape, convertedVectorFromShape, convertedVectorToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertSizeFromShape, convertSizeToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, delete, didChange, divideShapeFromEdge, divideShapeFromTop, dragExit, dragKeyAtPoint, dropKeyAtPoint, fromXMLDeep, get, getActionScript, getAnim, getAnim, getAnimator, getAnimator, getAutosizeHeight, getAutosizing, getBounds, getBoundsInside, getBoundsMarked, getBoundsOfChildren, getBoundsOfChildren, getBoundsSuperSelected, getCausesWrap, getCausesWrapType, getChild, getChildAnimator, getChildAnimator, getChildContaining, getChildCount, getChildLast, getChildren, getChildrenIntersecting, getChildrenWhoCauseWrap, getChildrenWhoDraw, getChildrenWhoHitTest, getChildSortedByX, getChildWithClass, getChildWithName, getColor, getCommonAncestor, getDocument, getFill, getFill, getFill, getFillCount, getFills, getFrame, getFrame, getFrameMaxX, getFrameMaxY, getFrameX, getFrameXY, getFrameY, getGroupShape, getHeight, getHeightToFit, getImageFill, getLineWidth, getListKeyDeep, getListKeyShape, getMaxX, getMaxY, getName, getOpacity, getOpacityDeep, getOutline, getPageCount, getPageShape, getParent, getParentCount, getParents, getPath, getPathInBounds, getPropertyKey, getPropertyKeyCount, getPropertyKeyName, getRoll, getRootShape, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSizeP, getSkewX, getSkewY, getStroke, getStrokeColor, getTextColor, getToolClassName, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getUrl, getWidth, getWidthToFit, getX, getXY, getXYP, getY, groupShapes, hasPageBreaks, height, indexOf, indexOf, intersects, isAncestor, isDescendant, isLocked, isRoot, isUnderlined, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, notRSS, offsetChildrenXY, offsetXY, page, pageBreakMax, pageBreakPageMax, pageMax, put, putPropertyKey, reclaimChildren, removeChild, removeChild, removeChildren, removeChildren, removeFromParent, resolvePageReferences, rpgCloneBase, rpgCloneChildren, rpgCloneConclude, rpgCloneNotification, rpgClonePrepare, rpgClonePreprocess, rpgCloneUrl, sendShapesToBack, setActionScript, setAnim, setAutosizeHeight, setAutosizing, setBounds, setBounds, setCausesWrapType, setChildren, setColor, setFill, setFrame, setFrame, setFrameSize, setFrameX, setFrameXY, setFrameXY, setFrameY, setHeight, setHeightDeep, setHeightDeep, setHeightToFit, setLineWidth, setLocked, setName, setNeedsRepaint, setNeedsRepaint, setOpacity, setOutline, setParent, setRoll, setScaleX, setScaleXY, setScaleY, setSize, setSize, setSizeDeep, setSizeP, setSizeToFit, setSizeToFit, setSkewX, setSkewXY, setSkewY, setStroke, setStrokeColor, setTextColor, setTime, setUnderlined, setUrl, setWidth, setWidthDeep, setWidthDeep, setWidthToFit, setX, setXY, setXY, setXYP, setY, sizesToFitChildren, toString, undoClone, undoCopy, undoEquals, undoerAddDirtyObject, undoerDisable, undoerEnable, undoerSetUndoTitle, width, willChange, willChange, x, y
Methods inherited from class com.reportmill.base.RMObject
didUndo, getAnimAttribute, getClassNameShort
-
Field Details
-
TYPE_BAR
- See Also:
-
TYPE_BAR_HORIZONTAL
- See Also:
-
TYPE_PIE
- See Also:
-
TYPES
-
EXTRUDE_NONE
- See Also:
-
EXTRUDE_FIRST
- See Also:
-
EXTRUDE_LAST
- See Also:
-
EXTRUDE_ALL
- See Also:
-
EXTRUDE_CUSTOM
- See Also:
-
EXTRUSIONS
-
-
Constructor Details
-
RMGraph
public RMGraph()Creates a plain graph shape.
-
-
Method Details
-
getListKey
Returns the list key associated with the graph.- Overrides:
getListKey
in classRMShape
-
setListKey
Sets the list key associated with the graph.- Overrides:
setListKey
in classRMShape
-
getFilterKey
Returns the optional key chain (expression) used to limit the table list derived from list key. -
setFilterKey
Returns the optional key chain (expression) used to limit the table list derived from list key. -
getKeysString
Returns keys string - a comma separated list of keys evaluated on list key objects to represent in graph. -
setKeysString
Sets keys string - a comma separated list of keys evaluated on list key objects to represent in graph. -
getKeys
Returns a list of the individual keys in the (potentially) comma separated keys string. -
getType
Returns the graph type (TYPE_BAR, TYPE_PIE, etc.). -
setType
Sets the graph type (TYPE_BAR, TYPE_PIE, etc.). -
getGraphTypeString
Returns the graph type as a simple string: bar, pie or hbar. -
setGraphTypeString
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
Returns the individual RMSort at the given index. -
getSorts
Returns the list of sorts associated with the graph. -
getTopNSort
Returns the top-n sort for this graph. -
setTopNSort
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. -
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
Returns the value axis' min, max and number of increments as a single string. -
setAxisMinMaxCount
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
Returns the key used to determine which pie wedges get extruded. -
setExtrusionKey
Sets the key used to determine which pie wedges get extruded. -
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
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. -
getColorCount
public int getColorCount()Returns the number of colors set for this graph. -
getColor
Returns the specific color at the given index. -
getColors
Returns the list of colors to be used by this graph (or the default graph colors, if null). -
setColors
Sets the list of colors to be used by this graph. -
getDefaultColors
Returns the default list of colors to be used by any graph without an explicit list of colors. -
setDefaultColors
Sets the default list of colors to be used by any graph without an explicit list of colors. -
getFont
Returns the font associated with the graph. -
setFont
Sets the font associated with the graph. -
getFormat
Returns the format associated with the value axis of the graph. -
setFormat
Sets the format associated with the value axis of the graph. -
acceptsFormat
public boolean acceptsFormat()RMEditor method (indicates that graphs have settable format).- Overrides:
acceptsFormat
in classRMShape
-
getBarWedgePrototype
Returns the shape used to represent the basic attributes of bars & wedges. -
setBarWedgePrototype
Sets the shape used to represent the basic attributes of bars & wedges. -
getContent
Returns the shape that represents the conent of the graph. -
equals
Standard equals implementation. -
copy
Copies the attributes from the given object into receiver (for undo). -
initWithArchiver
Legacy unarchival.- Specified by:
initWithArchiver
in interfaceRMArchiver.Archiving
- Overrides:
initWithArchiver
in classRMShape
-
toXML
XML archival. -
fromXML
XML unarchival. -
superSelectable
public boolean superSelectable()Editor method indicates that graph can be super selected.- Overrides:
superSelectable
in classRMShape
-
canBeUngrouped
public boolean canBeUngrouped()Editor method indicates that graph cannot be ungrouped.- Overrides:
canBeUngrouped
in classRMShape
-
acceptsChildren
public boolean acceptsChildren()Editor method indicates that graph can accept new children.- Overrides:
acceptsChildren
in classRMShape
-
rpgClone
Returns a clone of this shape with report generation. -
getSampleGraphContent
Returns a filled graph content for a given graph content.
-