java.lang.Object
de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems.AbstractRReportItem
de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems.AbstractPlotReportItem
All Implemented Interfaces:
IReportItem
Direct Known Subclasses:
CdfReportItem, HistogramReportItem, PdfReportItem, TimeSeriesReportItem

public abstract class AbstractPlotReportItem extends AbstractRReportItem
Report item to display generated graphics.
  • Field Details

    • DEFAULT_LEGEND_POSITION

      public static final AbstractPlotReportItem.LegendPosition DEFAULT_LEGEND_POSITION
      Default position of the legend.
    • DEFAULT_GRAPHIC_SIZE

      public static final int DEFAULT_GRAPHIC_SIZE
      Default size of the graphic.
      See Also:
    • DEFAULT_FONT_SIZE

      public static final int DEFAULT_FONT_SIZE
      Default font size for the graphic.
      See Also:
  • Constructor Details

    • AbstractPlotReportItem

      public AbstractPlotReportItem(String title)
      Constructs a new report item containing a plotted density graphic. The graphic is stored in a temporary file. This is accessible via the getFilename method.
      Parameters:
      title - Title of the plotted graphic.
    • AbstractPlotReportItem

      public AbstractPlotReportItem(String title, int height, int width, int fontSize)
      Constructs a new report item containing a plotted density graphic. The graphic is stored in a temporary file. This is accessible via the getFilename method.
      Parameters:
      title - Title of the plotted graphic.
      height - height of the plotted graphic.
      width - width of the plotted graphics.
      fontSize - the default pointsize of plotted text, interpreted at 72 dpi, so one point is approximately one pixel.
  • Method Details

    • addData

      public void addData(String id, String displayName, String rVariable)
      Adds a new data set to the plot.
      Parameters:
      id - Identifier for the data series.
      displayName - The display name for the data series.
      rVariable - The name of the R variable.
    • removeData

      public void removeData(String id)
      Remove the data series from the plot.
      Parameters:
      id - Identifier of the data series.
    • getDataSeries

      protected String[] getDataSeries()
      Returns the identifiers for the data series.
      Returns:
      the identifiers.
    • getName

      protected String getName(String id)
      Get the name for the data series.
      Parameters:
      id - The identifier of the data series.
      Returns:
      The name of the data series.
    • getDataCommand

      protected String getDataCommand(String id)
      Get the R variable for the data series.
      Parameters:
      id - The identifier of the data series.
      Returns:
      The name of the data series.
    • visit

      public void visit(IReportRenderingVisitor v)
      Used by the visitor to display the report item. Used to render the report item.
      Specified by:
      visit in interface IReportItem
      Specified by:
      visit in class AbstractRReportItem
      Parameters:
      v - Visitor used for rendering the content of each item.
    • getTemporaryRasterGraphicFilename

      public String getTemporaryRasterGraphicFilename()
      Returns the complete path to the temporary file containing the raster graphic.
      Returns:
      The complete path.
    • getTemporaryVectorGraphicFilename

      public String getTemporaryVectorGraphicFilename()
      Returns the complete path to the temporary file containing the vector graphic.
      Returns:
      The complete path.
    • generatePlotCommand

      protected abstract String generatePlotCommand()
      Overwrite this method to generate custom graphics.
      Returns:
      The R command which execution leads to the creation of the plot.
    • generateVectorGraphic

      public void generateVectorGraphic(File pdfFile, RConnection rConnection)
      Exports the plot as vector graphic in the PDF format.
      Parameters:
      pdfFile - The file to which the graphic is saved.
      rConnection - The connection to the R engine.
    • generateRasterGraphic

      public void generateRasterGraphic(File pngFile, RConnection rConnection)
      Exports the plot as raster graphic in the PNG format.
      Parameters:
      pngFile - The file to which the graphic is saved.
      rConnection - The connection to the R engine.
    • generateData

      public void generateData(RConnection connection)
      Initializes the generation of data for the report item.
      Parameters:
      connection - connection to the R engine used for the generation
    • generateLinesLegend

      protected String generateLinesLegend()
      Returns the R commands which generate a line legend in R.
      Returns:
      The necessary R commands.
    • generateColorsLegend

      protected String generateColorsLegend()
      Returns the R commands which generate a color legend in R.
      Returns:
      The necessary R commads.
    • setLegendPos

      public void setLegendPos(AbstractPlotReportItem.LegendPosition newLegendPosition)
      Sets the legend position.
      Parameters:
      newLegendPosition - New position to set.