Class AbstractPlotReportItem
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractPlotReportItem.LegendPositionPosition of the legend relative to the plot.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_FONT_SIZEDefault font size for the graphic.static intDEFAULT_GRAPHIC_SIZEDefault size of the graphic.static AbstractPlotReportItem.LegendPositionDEFAULT_LEGEND_POSITIONDefault position of the legend.-
Fields inherited from class de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems.AbstractRReportItem
DEFAULT_DESCRIPTION
-
-
Constructor Summary
Constructors Constructor Description AbstractPlotReportItem(String title)Constructs a new report item containing a plotted density graphic.AbstractPlotReportItem(String title, int height, int width, int fontSize)Constructs a new report item containing a plotted density graphic.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddData(String id, String displayName, String rVariable)Adds a new data set to the plot.protected StringgenerateColorsLegend()Returns the R commands which generate a color legend in R.voidgenerateData(RConnection connection)Initializes the generation of data for the report item.protected StringgenerateLinesLegend()Returns the R commands which generate a line legend in R.protected abstract StringgeneratePlotCommand()Overwrite this method to generate custom graphics.voidgenerateRasterGraphic(File pngFile, RConnection rConnection)Exports the plot as raster graphic in the PNG format.voidgenerateVectorGraphic(File pdfFile, RConnection rConnection)Exports the plot as vector graphic in the PDF format.protected StringgetDataCommand(String id)Get the R variable for the data series.protected String[]getDataSeries()Returns the identifiers for the data series.protected StringgetName(String id)Get the name for the data series.StringgetTemporaryRasterGraphicFilename()Returns the complete path to the temporary file containing the raster graphic.StringgetTemporaryVectorGraphicFilename()Returns the complete path to the temporary file containing the vector graphic.voidremoveData(String id)Remove the data series from the plot.voidsetLegendPos(AbstractPlotReportItem.LegendPosition newLegendPosition)Sets the legend position.voidvisit(IReportRenderingVisitor v)Used by the visitor to display the report item.-
Methods inherited from class de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems.AbstractRReportItem
getDescription
-
-
-
-
Field Detail
-
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:
- Constant Field Values
-
DEFAULT_FONT_SIZE
public static final int DEFAULT_FONT_SIZE
Default font size for the graphic.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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:
visitin interfaceIReportItem- Specified by:
visitin classAbstractRReportItem- 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.
-
-