ReportMill 11 API

com.reportmill.graphing
Class RMGraph

java.lang.Object
  extended by com.reportmill.base.RMObject
      extended by com.reportmill.shape.RMShape
          extended by com.reportmill.graphing.RMGraph
All Implemented Interfaces:
com.reportmill.base.RMPropertyChanger, java.beans.PropertyChangeListener, java.lang.Cloneable, java.util.EventListener

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.setDatasetKey("Movies");
  graph.setKeysString("revenue");
  graph.setType(RMGraph.TYPE_PIE);
  


Field Summary
static java.lang.String TYPE_AREA
           
static java.lang.String TYPE_BAR
           
static java.lang.String TYPE_BARH
           
static java.lang.String TYPE_LINE
           
static java.lang.String TYPE_PIE
           
static java.lang.String TYPE_SCATTER
           
static java.lang.String[] TYPES
           
 
Fields inherited from class com.reportmill.shape.RMShape
WRAP_TYPE_BOTH, WRAP_TYPE_NONE
 
Constructor Summary
RMGraph()
          Creates a plain graph shape.
 
Method Summary
 void addGroupingKey(java.lang.String aKey)
          Adds a grouping to the table for the given key string.
 void addGroupingKey(java.lang.String aKey, int anIndex)
          Adds a grouping to the table for the given key string at the given grouping index.
 void addKey(java.lang.String aKey)
          Adds a key.
 void clearKeys()
          Removes all keys.
 RMGraph clone()
          Standard clone implementation.
 boolean equals(java.lang.Object anObj)
          Standard equals implementation.
 java.lang.Object fromXMLShape(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement, java.lang.Object anOwner)
          XML unarchival.
 RMShape getBarWedgePrototype()
          Returns the shape used to represent the basic attributes of bars & wedges.
 RMShape getChild(int anIndex)
          Override to return table rpg if set.
 int getChildCount()
          Override to return table rpg if set.
 RMColor getColor(int anIndex)
          Returns the specific color at the given index.
 int getColorCount()
          Returns the number of colors set for this graph.
 java.util.List getColors()
          Returns the list of colors to be used by this graph (or the default graph colors, if null).
 java.lang.String getDatasetKey()
          Returns the dataset key associated with 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.
 java.lang.String getFilterKey()
          Returns the optional key chain (expression) used to limit the table list derived from dataset key.
 RMGraphArea getGraphArea()
          Returns the shape that represents the conent of the graph.
 java.lang.String getGraphTypeString()
          Returns the graph type as a simple string: bar, pie or hbar.
 com.reportmill.base.RMGrouper getGrouper()
          Returns the grouper associated with the table.
 RMGrouping getGrouping()
          Returns the graph grouping.
 RMGrouping getGrouping(int anIndex)
          Returns the individual grouping at the given index.
 RMGrouping getGrouping(java.lang.String aKey)
          Returns the individual grouping that has the same key as the one given.
 int getGroupingCount()
          Returns the number of groups in this table.
 java.lang.Float getInterval(int anIndex)
          Returns the individual interval at a given index as a float value.
 int getIntervalCount()
          Returns the number of intervals for this filled graph.
 java.lang.Float getIntervalLast()
          Returns the last interval as a float value.
 java.lang.String getKey(int anIndex)
          Returns the specific key at the given index.
 int getKeyCount()
          Returns the number of keys for this graph.
 RMGraphLegend getLegend()
          Returns the child of the graph that represents the legend (if present).
 int getMinorTickCount()
          Returns the number of suggested ticks between the intervals of the RPG'd graph.
 java.util.List getObjects()
          Returns the list of objects to generate a graph for.
 com.reportmill.base.ReportMill getReportMill()
          Returns the reportmill.
 java.util.List getSampleObjects()
          Returns a list of sample objects for this graph.
 RMGraphSection getSection(int anIndex)
          Returns the individual section at the given index.
 int getSectionCount()
          Returns the number of sections in this graph.
 RMGraphSeries getSeries(int anIndex)
          Returns the individual series at the given index.
 int getSeriesCount()
          Returns the number of series in this graph.
 boolean getShowLegend()
          Returns whether the graph shows a legend.
 java.lang.String getType()
          Returns the graph type (TYPE_BAR, TYPE_PIE, etc.).
 void moveGrouping(int index1, int index2)
          Moves the grouping at the first index so that it resides at the second index.
 void rebuild()
          Rebuild graph.
 void removeGrouping(RMGrouping aGrouping)
          Removes the given grouping.
 void removeKey(int anIndex)
          Removes a key.
 void setBarWedgePrototype(RMShape aShape)
          Sets the shape used to represent the basic attributes of bars & wedges.
 void setColors(java.util.List aColorList)
          Sets the list of colors to be used by this graph.
 void setDatasetKey(java.lang.String aKeyPath)
          Sets the dataset key associated with the 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 setFilterKey(java.lang.String aKeyExpr)
          Sets the optional key chain (expression) used to limit the table list derived from dataset key.
 void setGraphTypeString(java.lang.String aString)
          Sets the graph type as a simple string: bar, pie or hbar.
 void setObjects(java.util.List aList)
          Sets the list of objects to generate a graph for.
 void setReportMill(com.reportmill.base.ReportMill aReportMill)
          Set ReportMill (which tries to get a dataset from reportmill and calls setObjects).
 void setReportMillDeep(com.reportmill.base.ReportMill aReportMill)
          Override to stifle child rpg.
 void setShowLegend(boolean aFlag)
          Sets whether the graph shows a legend.
 void setType(java.lang.String aType)
          Sets the graph type (TYPE_BAR, TYPE_PIE, etc.).
 com.reportmill.archiver.RXElement toXMLShape(com.reportmill.archiver.RXArchiver anArchiver, java.lang.Object anOwner)
          XML archival.
 
Methods inherited from class com.reportmill.shape.RMShape
acceptsChildren, acceptsMouse, addBinding, addChild, addChild, animUpdate, bounds, boundsChanged, boundsChanged, bringShapesToFront, checkBindings, childrenSuperSelectImmediately, cloneDeep, contains, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertedSizeFromShape, convertedSizeToShape, convertedVectorFromShape, convertedVectorToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertSizeFromShape, convertSizeToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, createDivideShapeRemainder, createLayout, createPartClone, divideShapeFromEdge, divideShapeFromTop, doLayout, firePropertyChange, fromXML, fromXMLShapeChildren, get, getAction, getAncestor, getAncestorCount, getAncestorInCommon, getAnim, getAnim, getAnimator, getAnimator, getAspectMapped, getAspects, getAutosizeHeight, getAutosizing, getBinder, getBinding, getBinding, getBindingCount, getBounds, getBoundsInside, getBoundsMarked, getBoundsMarkedDeep, getBoundsOfChildren, getCausesWrap, getCausesWrapType, getChildAnimator, getChildAnimator, getChildArray, getChildClipShape, getChildContaining, getChildCountHitable, getChildCountLayout, getChildCountVisible, getChildHitable, getChildLast, getChildLayout, getChildren, getChildrenIntersecting, getChildrenWhoCauseWrap, getChildrenWithClass, getChildrenWithClass, getChildVisible, getChildWithClass, getChildWithName, getClipShape, getColor, getDatasetEntity, getDocument, getEffect, getFill, getFill, getFillCount, getFont, getFormat, getFrame, getFrame, getFrameMaxX, getFrameMaxY, getFrameX, getFrameXY, getFrameY, getHeight, getHeightToFit, getImageFill, getLayout, getLineWidth, getMaskPath, getMaxX, getMaxY, getName, getOpacity, getOpacityDeep, getOriginal, getOutline, getPageBreak, getPageBreakMax, getPageBreakPage, getPageBreakPageMax, getPageShape, getParent, getParentWithClass, getPart, getPartCount, getPartDeep, getPartDeepCount, getPath, getPathInBounds, getRoll, getRootShape, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSizeP, getSkewX, getSkewY, getStroke, getStrokeColor, getTextColor, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getUrl, getVisbileBounds, getVisibleBounds, getVisibleBounds, getVisibleBounds, getWidth, getWidthToFit, getX, getXY, getXYP, getY, height, indexOf, indexOfChild, intersects, isAncestor, isAnimProperty, isDescendant, isEditing, isLocked, isMouseDown, isMouseOver, isRoot, isShowing, isUnderlined, isValid, isViewing, isVisible, layoutReset, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, notRSS, offsetChildrenXY, offsetXY, page, pageMax, paint, paintShape, paintShapeAll, paintShapeChildren, paintShapeOver, propertyChange, put, removeBinding, removeBinding, removeChild, removeChild, removeChildren, removeFromParent, repaint, repaint, resolvePageReferences, revalidate, sendShapesToBack, setAction, setAnim, setAutosizeHeight, setAutosizing, setBounds, setBounds, setCausesWrap, setCausesWrapType, setColor, setEffect, setFill, setFont, setFormat, setFrame, setFrame, setFrameSize, setFrameX, setFrameXY, setFrameXY, setFrameY, setHeight, setHeightToFit, setLayout, setLayoutEnabled, setLineWidth, setLocked, setName, setOpacity, setOutline, setParent, setReportMillBindings, setRoll, setScaleX, setScaleXY, setScaleY, setSize, setSize, setSizeP, setSizeToFit, setSizeToFit, setSkewX, setSkewXY, setSkewY, setStroke, setStrokeColor, setTextColor, setTime, setUnderlined, setUrl, setVisible, setWidth, setWidthToFit, setX, setXY, setXY, setXYP, setY, shapeHidden, shapeShown, sizesToFitChildren, superSelectable, toString, toXML, toXMLShapeChildren, undoerDisable, undoerEnable, undoerSetUndoTitle, validate, width, x, y
 
Methods inherited from class com.reportmill.base.RMObject
addListener, addPropertyChangeListener, firePropertyChange, getListener, getListenerCount, getListeners, isFirePropertyChangeEnabled, isUndoing, removeListener, removePropertyChangeListener, setFirePropertyChangeEnabled, setUndoing
 
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_BARH

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

TYPE_AREA

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

TYPE_LINE

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

TYPE_SCATTER

public static final java.lang.String TYPE_SCATTER
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
Constructor Detail

RMGraph

public RMGraph()
Creates a plain graph shape.

Method Detail

getDatasetKey

public java.lang.String getDatasetKey()
Returns the dataset key associated with the graph.

Overrides:
getDatasetKey in class RMShape

setDatasetKey

public void setDatasetKey(java.lang.String aKeyPath)
Sets the dataset key associated with the graph.


getFilterKey

public java.lang.String getFilterKey()
Returns the optional key chain (expression) used to limit the table list derived from dataset key.


setFilterKey

public void setFilterKey(java.lang.String aKeyExpr)
Sets the optional key chain (expression) used to limit the table list derived from dataset key.


getKeyCount

public int getKeyCount()
Returns the number of keys for this graph.


getKey

public java.lang.String getKey(int anIndex)
Returns the specific key at the given index.


addKey

public void addKey(java.lang.String aKey)
Adds a key.


removeKey

public void removeKey(int anIndex)
Removes a key.


clearKeys

public void clearKeys()
Removes all keys.


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.


getGrouping

public RMGrouping getGrouping()
Returns the graph grouping.


getGrouper

public com.reportmill.base.RMGrouper getGrouper()
Returns the grouper associated with the table.


getGroupingCount

public int getGroupingCount()
Returns the number of groups in this table.


getGrouping

public RMGrouping getGrouping(int anIndex)
Returns the individual grouping at the given index.


getGrouping

public RMGrouping getGrouping(java.lang.String aKey)
Returns the individual grouping that has the same key as the one given.


addGroupingKey

public void addGroupingKey(java.lang.String aKey)
Adds a grouping to the table for the given key string.


addGroupingKey

public void addGroupingKey(java.lang.String aKey,
                           int anIndex)
Adds a grouping to the table for the given key string at the given grouping index. You can also supply specific table rows for headers, details and/or summary.


removeGrouping

public void removeGrouping(RMGrouping aGrouping)
Removes the given grouping.


moveGrouping

public void moveGrouping(int index1,
                         int index2)
Moves the grouping at the first index so that it resides at the second index.


getDraw3D

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


setDraw3D

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


getLegend

public RMGraphLegend 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

public RMColor getColor(int anIndex)
Returns the specific color at the given index. Automatically wraps if index exceeds color count.


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 aColorList)
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.


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.


getGraphArea

public RMGraphArea getGraphArea()
Returns the shape that represents the conent of the graph.


getReportMill

public com.reportmill.base.ReportMill getReportMill()
Returns the reportmill.

Overrides:
getReportMill in class RMShape

setReportMill

public void setReportMill(com.reportmill.base.ReportMill aReportMill)
Set ReportMill (which tries to get a dataset from reportmill and calls setObjects).

Overrides:
setReportMill in class RMShape

setReportMillDeep

public void setReportMillDeep(com.reportmill.base.ReportMill aReportMill)
Override to stifle child rpg.

Overrides:
setReportMillDeep in class RMShape

getObjects

public java.util.List getObjects()
Returns the list of objects to generate a graph for.


setObjects

public void setObjects(java.util.List aList)
Sets the list of objects to generate a graph for.


getSeriesCount

public int getSeriesCount()
Returns the number of series in this graph.


getSeries

public RMGraphSeries getSeries(int anIndex)
Returns the individual series at the given index.


getSectionCount

public int getSectionCount()
Returns the number of sections in this graph.


getSection

public RMGraphSection getSection(int anIndex)
Returns the individual section at the given index.


getIntervalCount

public int getIntervalCount()
Returns the number of intervals for this filled graph.


getInterval

public java.lang.Float getInterval(int anIndex)
Returns the individual interval at a given index as a float value.


getIntervalLast

public java.lang.Float getIntervalLast()
Returns the last interval as a float value.


getMinorTickCount

public int getMinorTickCount()
Returns the number of suggested ticks between the intervals of the RPG'd graph.


getSampleObjects

public java.util.List getSampleObjects()
Returns a list of sample objects for this graph.


getChildCount

public int getChildCount()
Override to return table rpg if set.

Overrides:
getChildCount in class RMShape

getChild

public RMShape getChild(int anIndex)
Override to return table rpg if set.

Overrides:
getChild in class RMShape

rebuild

public void rebuild()
Rebuild graph.


equals

public boolean equals(java.lang.Object anObj)
Standard equals implementation.

Overrides:
equals in class RMShape

clone

public RMGraph clone()
Standard clone implementation.

Overrides:
clone in class RMShape

toXMLShape

public com.reportmill.archiver.RXElement toXMLShape(com.reportmill.archiver.RXArchiver anArchiver,
                                                    java.lang.Object anOwner)
XML archival.

Overrides:
toXMLShape in class RMShape

fromXMLShape

public java.lang.Object fromXMLShape(com.reportmill.archiver.RXArchiver anArchiver,
                                     com.reportmill.archiver.RXElement anElement,
                                     java.lang.Object anOwner)
XML unarchival.

Overrides:
fromXMLShape in class RMShape

ReportMill 11 API