Class RMGraph

All Implemented Interfaces:
Archivable, DeepChangeListener, RMPropertyChanger, RMTypes, PropertyChangeListener, Cloneable, EventListener

public class RMGraph extends RMParentShape
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);
 

  • Constructor Details

    • RMGraph

      public RMGraph()
  • Method Details

    • getDatasetKey

      public String getDatasetKey()
      Returns the dataset key associated with the graph.
      Overrides:
      getDatasetKey in class RMShape
    • setDatasetKey

      public void setDatasetKey(String aKeyPath)
      Sets the dataset key associated with the graph.
    • getFilterKey

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

      public void setFilterKey(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 String getKey(int anIndex)
      Returns the specific key at the given index.
    • addKey

      public void addKey(String aKey)
      Adds a key.
    • removeKey

      public void removeKey(int anIndex)
      Removes a key.
    • clearKeys

      public void clearKeys()
      Removes all keys.
    • getType

      public RMGraph.Type getType()
      Returns the graph type (TYPE_BAR, TYPE_PIE, etc.).
    • setType

      public void setType(RMGraph.Type aType)
      Sets the graph type (TYPE_BAR, TYPE_PIE, etc.).
    • getGraphTypeString

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

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

      public RMGrouping getGrouping()
      Returns the graph grouping.
    • getSectionLayout

      public RMGraph.SectionLayout getSectionLayout()
      Returns the layout of series values.
    • setSectionLayout

      public void setSectionLayout(RMGraph.SectionLayout aLayout)
      Sets the layout of series values.
    • getItemsLayout

      public RMGraph.ItemLayout getItemsLayout()
      Returns the layout of section items.
    • setItemsLayout

      public void setItemsLayout(RMGraph.ItemLayout aLayout)
      Sets the layout of section items.
    • isVertical

      public boolean isVertical()
      Returns whether graph area is considered vertical.
    • isAbreast

      public boolean isAbreast()
      Returns whether section items layout is abreast.
    • isStacked

      public boolean isStacked()
      Returns whether section items layout is stacked.
    • isLayered

      public boolean isLayered()
      Returns whether section items layout is layered.
    • repaint

      public void repaint()
      Overrides shape implementation to repaint parent too.
      Overrides:
      repaint in class RMShape
    • relayout

      public void relayout()
      Overrides to relayout legend too.
      Overrides:
      relayout in class RMParentShape
    • getValueAxis

      public RMGraphPartValueAxis getValueAxis()
      Returns the value axis shape.
    • getLabelAxis

      public RMGraphPartLabelAxis getLabelAxis()
      Returns the label axis shape.
    • getBars

      public RMGraphPartBars getBars()
      Returns the bars shape.
    • getPie

      public RMGraphPartPie getPie()
      Returns the pie shape.
    • getSeriesCount

      public int getSeriesCount()
      Returns the number of series.
    • getSeries

      public RMGraphPartSeries getSeries(int anIndex)
      Returns the individual series object and the given index.
    • get3D

      public RMScene3D get3D()
      Returns the 3d shape.
    • 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 List<RMColor> getColors()
      Returns the list of colors to be used by this graph (or the default graph colors, if null).
    • setColors

      public void setColors(List aColorList)
      Sets the list of colors to be used by this graph.
    • getDefaultColors

      public static 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(List aList)
      Sets the default list of colors to be used by any graph without an explicit list of colors.
    • layoutChildren

      protected void layoutChildren()
      Creates and adds new GraphArea.
      Overrides:
      layoutChildren in class RMParentShape
    • isHittable

      protected boolean isHittable(RMShape aChild)
      Override to suppress selection of children.
      Overrides:
      isHittable in class RMParentShape
    • createSampleGraph

      public RMShape createSampleGraph()
      Returns a graph area configured like this one showing sample data.
    • getSampleGraph

      public static RMShape getSampleGraph()
    • propertyChange

      public void propertyChange(PropertyChangeEvent anEvent)
      Overrides normal version to suppress child changes and propagate part changes.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Overrides:
      propertyChange in class RMShape
    • rpgAll

      public RMParentShape rpgAll(ReportOwner anRptOwner, RMShape aParent)
      Set ReportMill (which tries to get a dataset from reportmill and calls setObjects).
      Overrides:
      rpgAll in class RMParentShape
    • paintShape

      public void paintShape(RMShapePainter aPntr)
      Override to suppress background paint.
      Overrides:
      paintShape in class RMShape
    • paintShapeOver

      public void paintShapeOver(RMShapePainter aPntr)
      Override to paint GraphArea parts.
      Overrides:
      paintShapeOver in class RMShape
    • getPartCount

      public int getPartCount()
      Returns the number of graph parts.
    • getPart

      public RMShape getPart(int anIndex)
      Returns the individual part at index.
    • getPartName

      public String getPartName(int anIndex)
      Returns the individual part at index.
    • getParts

      public RMShape[] getParts()
      Returns the parts.
    • getFontBox

      public RMGraph.FontBox getFontBox(int anIndex)
      Returns the font box for part at index.
    • clone

      public RMGraph clone()
      Standard clone implementation.
      Overrides:
      clone in class RMParentShape
    • toXMLShape

      protected RXElement toXMLShape(RXArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLShape in class RMParentShape
    • fromXMLShape

      protected void fromXMLShape(RXArchiver anArchiver, RXElement anElement)
      XML unarchival.
      Overrides:
      fromXMLShape in class RMParentShape
    • toXMLChildren

      protected void toXMLChildren(RXArchiver anArchiver, RXElement anElement)
      XML archival - override shape implementation to suppress archival of children.
      Overrides:
      toXMLChildren in class RMParentShape
    • fromXMLChildren

      protected void fromXMLChildren(RXArchiver anArchiver, RXElement anElement)
      XML unarchival - override to suppress unarchival of children (don't really need this).
      Overrides:
      fromXMLChildren in class RMParentShape
    • fromXML

      public RMShape fromXML(RXArchiver anArchiver, RXElement anElement)
      Legacy unarchival.
      Specified by:
      fromXML in interface Archivable
      Overrides:
      fromXML in class RMParentShape