java.lang.Object
com.reportmill.base.RMObject
com.reportmill.shape.RMShape
com.inductiveautomation.factorypmi.plugins.reporting.shapes.LineGraph
All Implemented Interfaces:
RMArchiver.Archiving, Java2DShapePainter, RMShapePainter.Paint, Cloneable

public class LineGraph extends RMShape implements RMShapePainter.Paint, Java2DShapePainter
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);
 

  • Field Details

  • Constructor Details

    • LineGraph

      public LineGraph()
      Creates a plain graph shape.
  • Method Details

    • buildChart

      public void buildChart()
    • getListKey

      public String getListKey()
      Returns the list key associated with the graph.
      Overrides:
      getListKey in class RMShape
    • setListKey

      public void setListKey(String aKeyPath)
      Sets the list key associated with the graph.
      Overrides:
      setListKey in class RMShape
    • getFilterKey

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

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

      public String getKeysString()
      Returns keys string - a comma separated list of keys evaluated on list key objects to represent in graph.
    • setKeysString

      public void setKeysString(String aString)
      Sets keys string - a comma separated list of keys evaluated on list key objects to represent in graph.
    • getKeys

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

      public String getType()
      Returns the graph type (TYPE_LINE, TYPE_AREA, etc.).
    • setType

      public void setType(String aType)
      Sets the graph type (TYPE_LINE, TYPE_AREA, 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.
    • 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 List getSorts()
      Returns the list of sorts associated with the graph.
    • 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).
    • getAxisMinMaxCount

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

      public void setAxisMinMaxCount(String aValue)
      Sets the value axis' min, max and number of increments as a single string.
    • 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.
    • getColors

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

      public void setColors(List aList)
      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.
    • 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
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class RMShape
    • copy

      public void copy(Object anObj)
      Copies the attributes from the given object into receiver (for undo).
      Overrides:
      copy in class RMShape
    • toXML

      public RXElement toXML(RXArchiver anArchiver)
      XML archival.
      Overrides:
      toXML in class RMShape
    • fromXML

      public Object fromXML(RXArchiver anArchiver, RXElement anElement)
      XML unarchival.
      Overrides:
      fromXML in class RMShape
    • paintShape

      public void paintShape(RMShapePainter aPainter, Graphics2D g)
      Specified by:
      paintShape in interface RMShapePainter.Paint
    • basePaint

      public void basePaint(Graphics2D g, Rectangle2D rect)
      Specified by:
      basePaint in interface Java2DShapePainter
    • rpgClone

      public RMShape rpgClone(ReportMill aReportMill)
      Returns a clone of this shape with report generation.
      Overrides:
      rpgClone in class RMShape
    • getGroups

      public List getGroups()
      Returns the keys to be graphed (unless swapped, in which case it returns the objects).
    • getSeries

      public List getSeries()
      Returns the objects to be graphed (unless swapped, in which case it returns the keys).
    • doubleValueForKeyChain

      public double doubleValueForKeyChain(Object anObj, Object aKey)
      Returns a double value for the given object and key (automatically handles "swapped" case).
    • dateValueForKeyChain

      public Date dateValueForKeyChain(Object anObj, Object aKey)
      Returns a date value for the given object and key (automatically handles "swapped" case).
    • getToolClassName

      public String getToolClassName()
      Description copied from class: RMShape
      Editor method - returns the tool class name for this shape.
      Overrides:
      getToolClassName in class RMShape
    • isShowXAxis

      public boolean isShowXAxis()
    • setShowXAxis

      public void setShowXAxis(boolean axis)
    • isShowYAxis

      public boolean isShowYAxis()
    • setShowYAxis

      public void setShowYAxis(boolean axis)
    • isTimeseries

      public boolean isTimeseries()
    • setTimeseries

      public void setTimeseries(boolean timeseries)
    • getXAxisLabel

      public String getXAxisLabel()
    • setXAxisLabel

      public void setXAxisLabel(String axisLabel)
    • getYAxisLabel

      public String getYAxisLabel()
    • setYAxisLabel

      public void setYAxisLabel(String axisLabel)