Package com.illumon.iris.db.plot
Class BaseFigureImpl
java.lang.Object
com.illumon.iris.db.plot.BaseFigureImpl
- All Implemented Interfaces:
BaseFigure
,PlotExceptionCause
,Serializable
public class BaseFigureImpl extends Object implements BaseFigure, PlotExceptionCause
Container for
Chart
s.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description BaseFigureImpl()
Creates a new Figure instance with a 1x1 grid.BaseFigureImpl(int numRows, int numCols)
Creates a new Figure instance with anumRows
xnumCols
grid.protected
BaseFigureImpl(BaseFigureImpl figure)
Creates a copy of a Figure. -
Method Summary
Modifier and Type Method Description ChartImpl
chart(int index)
Returns a chart from this Figure's grid.ChartImpl
chart(int rowNum, int colNum)
Returns a chart from this Figure's grid.void
consolidateTableMaps()
void
consolidateTables()
BaseFigureImpl
copy()
Creates a copy of this Figure.BaseFigureImpl
figureRemoveSeries(String... names)
Removes all series withnames
from this Figure.BaseFigureImpl
figureTitle(String title)
Sets the title of this FigureBaseFigureImpl
figureTitleColor(Paint color)
Sets the color of this Figure's titleBaseFigureImpl
figureTitleColor(String color)
Sets the color of this Figure's titleBaseFigureImpl
figureTitleFont(Font font)
Sets the font of this Figure's titleBaseFigureImpl
figureTitleFont(String family, String style, int size)
Sets the font of this Figure's titleChartArray
getCharts()
Gets this Figure'sChart
s.List<FigureImplFunction>
getFigureFunctionList()
LambdaGovernor
getGovernor()
int
getHeight()
Gets the numRows of this Figure.FigureTableSnapshotManager
getManager()
String
getName()
PlotInfo
getPlotInfo()
int
getSessionId()
Map<Table,Set<Function<Table,Table>>>
getTableFunctionMap()
Set<TableHandle>
getTableHandles()
Gets the table handles associated with this figure.Map<TableMap,Set<Function<TableMap,TableMap>>>
getTableMapFunctionMap()
Theme
getTheme()
Gets theTheme
of this Figure.String
getTitle()
Gets the title of this Figure.Paint
getTitleColor()
Gets thePaint
of this Figure's title.Font
getTitleFont()
Gets theFont
of this Figure's title.long
getUpdateInterval()
Gets the updateInterval, in milliseconds, for this Figure.int
getWidth()
Gets the width of this Figure.InitializationGate
initializationGate()
boolean
isDefaultTheme()
boolean
isResizable()
Whether this Figure's height and width are changeable.ChartImpl
newChart()
Adds a newChart
to this figure.ChartImpl
newChart(int index)
Adds a newChart
to this figure.ChartImpl
newChart(int rowNum, int colNum)
Adds a newChart
to this figure.void
onClose()
Tear down once figure is closed.void
onInflate()
void
registerFigureFunction(FigureImplFunction function)
void
registerTableFunction(Table t, Function<Table,Table> function)
void
registerTableMapFunction(TableMapHandle tableMapHandle, Function<Table,Table> tableTransform)
BaseFigureImpl
removeChart(int index)
Removes a chart from the Figure's grid.BaseFigureImpl
removeChart(int rowNum, int colNum)
Removes a chart from the Figure's grid.BaseFigure
save(String saveLocation, boolean wait, long timeoutSeconds)
Saves the Figure as an image.BaseFigure
save(String saveLocation, int width, int height, boolean wait, long timeoutSeconds)
Saves the Figure as an image.void
setGovernor(LambdaGovernor newGovernor)
void
setManager(FigureTableSnapshotManager manager)
void
setName(String figureName)
void
setSessionId(int sessionId)
void
setTableSnapshotsAndRegisterListeners(FigureTableSnapshotManager manager)
BaseFigureImpl
theme(Theme theme)
Sets theTheme
of this FigureBaseFigureImpl
theme(String theme)
Sets theTheme
of this FigureBaseFigureImpl
updateInterval(long updateIntervalMillis)
Sets the update interval of this Figure.void
validateInitialization()
Checks if the figure can be instantiated.
-
Constructor Details
-
BaseFigureImpl
public BaseFigureImpl()Creates a new Figure instance with a 1x1 grid. If newChart() with no arguments is called on this new Figure, the Figure will resize itself to hold the newChart
. -
BaseFigureImpl
public BaseFigureImpl(int numRows, int numCols)Creates a new Figure instance with anumRows
xnumCols
grid.- Parameters:
numRows
- number of rowsnumCols
- number of columns
-
BaseFigureImpl
Creates a copy of a Figure.- Parameters:
figure
- figure to copy.
-
-
Method Details
-
copy
Creates a copy of this Figure.- Returns:
- copy of this Figure.
-
getTheme
Gets theTheme
of this Figure.- Returns:
- this Figure's theme
-
getWidth
public int getWidth()Gets the width of this Figure. This is equal to the number of columns.- Returns:
- this Figure's width
-
getHeight
public int getHeight()Gets the numRows of this Figure. This is equal to the number of rows.- Returns:
- this Figure's height
-
getTitle
Gets the title of this Figure.- Returns:
- this Figure's title
-
getTitleFont
Gets theFont
of this Figure's title.- Returns:
- this Figure's title's
Font
-
getTitleColor
Gets thePaint
of this Figure's title.- Returns:
- this Figure's title's
Paint
-
isResizable
public boolean isResizable()Whether this Figure's height and width are changeable.- Returns:
- true if this Figure's height and width are changeable, false otherwise
-
getCharts
Gets this Figure'sChart
s.- Returns:
- this Figure's
Chart
s
-
getUpdateInterval
public long getUpdateInterval()Gets the updateInterval, in milliseconds, for this Figure.- Returns:
- update interval of this Figure, in milliseconds
-
isDefaultTheme
public boolean isDefaultTheme() -
getTableHandles
Gets the table handles associated with this figure.- Returns:
- table handles associated with this figure.
-
getGovernor
-
setGovernor
-
getManager
-
setManager
-
setTableSnapshotsAndRegisterListeners
-
figureRemoveSeries
Description copied from interface:BaseFigure
Removes all series withnames
from this Figure.- Specified by:
figureRemoveSeries
in interfaceBaseFigure
- Parameters:
names
- series names- Returns:
- this Figure
-
onInflate
public void onInflate() -
onClose
public void onClose()Tear down once figure is closed. -
registerTableFunction
-
getTableFunctionMap
-
registerTableMapFunction
public void registerTableMapFunction(TableMapHandle tableMapHandle, Function<Table,Table> tableTransform) -
getTableMapFunctionMap
-
registerFigureFunction
-
getFigureFunctionList
-
theme
Description copied from interface:BaseFigure
Sets theTheme
of this Figure- Specified by:
theme
in interfaceBaseFigure
- Parameters:
theme
- theme- Returns:
- this Figure
-
theme
Description copied from interface:BaseFigure
Sets theTheme
of this Figure- Specified by:
theme
in interfaceBaseFigure
- Parameters:
theme
- theme name- Returns:
- this Figure
-
updateInterval
Description copied from interface:BaseFigure
Sets the update interval of this Figure. The plot will be redrawn at this update interval.- Specified by:
updateInterval
in interfaceBaseFigure
- Parameters:
updateIntervalMillis
- update interval, in milliseconds- Returns:
- this Figure
-
figureTitle
Description copied from interface:BaseFigure
Sets the title of this Figure- Specified by:
figureTitle
in interfaceBaseFigure
- Parameters:
title
- title- Returns:
- this Figure
-
figureTitleFont
Description copied from interface:BaseFigure
Sets the font of this Figure's title- Specified by:
figureTitleFont
in interfaceBaseFigure
- Parameters:
font
- font- Returns:
- this Figure
-
figureTitleFont
Description copied from interface:BaseFigure
Sets the font of this Figure's title- Specified by:
figureTitleFont
in interfaceBaseFigure
- Parameters:
family
- font family; if null, set to Arialstyle
- font style; if null, set toFont.FontStyle
PLAINsize
- the point size of the Font- Returns:
- this Figure
-
figureTitleColor
Description copied from interface:BaseFigure
Sets the color of this Figure's title- Specified by:
figureTitleColor
in interfaceBaseFigure
- Parameters:
color
- color- Returns:
- this Figure
-
figureTitleColor
Description copied from interface:BaseFigure
Sets the color of this Figure's title- Specified by:
figureTitleColor
in interfaceBaseFigure
- Parameters:
color
- color- Returns:
- this Figure
-
newChart
Description copied from interface:BaseFigure
Adds a newChart
to this figure.- Specified by:
newChart
in interfaceBaseFigure
- Returns:
- the new
Chart
. TheChart
is placed in the next available grid space, starting at the upper left hand corner of the grid, going left to right, top to bottom. If no available space is found in the grid:- if this Figure was created with no specified grid size, then the Figure will resize itself to add the new
Chart
; - if not, a RuntimeException will be thrown.
- if this Figure was created with no specified grid size, then the Figure will resize itself to add the new
-
newChart
Description copied from interface:BaseFigure
Adds a newChart
to this figure.- Specified by:
newChart
in interfaceBaseFigure
- Parameters:
index
- index from the Figure's grid to remove. The index starts at 0 in the upper left hand corner of the grid and increases going left to right, top to bottom. E.g. for a 2x2 Figure, the indices would be [0, 1] [2, 3].- Returns:
- the new
Chart
. TheChart
is placed at the grid space indicated by theindex
.
-
newChart
Description copied from interface:BaseFigure
Adds a newChart
to this figure.- Specified by:
newChart
in interfaceBaseFigure
- Parameters:
rowNum
- row index in this Figure's grid. The row index starts at 0.colNum
- column index in this Figure's grid. The column index starts at 0.- Returns:
- the new
Chart
. TheChart
is placed at the grid space [rowNum
,colNum
.
-
removeChart
Description copied from interface:BaseFigure
Removes a chart from the Figure's grid.- Specified by:
removeChart
in interfaceBaseFigure
- Parameters:
index
- index from the Figure's grid to remove. The index starts at 0 in the upper left hand corner of the grid and increases going left to right, top to bottom. E.g. for a 2x2 Figure, the indices would be [0, 1] [2, 3].- Returns:
- this Figure with the chart removed.
-
removeChart
Description copied from interface:BaseFigure
Removes a chart from the Figure's grid.- Specified by:
removeChart
in interfaceBaseFigure
- Parameters:
rowNum
- row index in this Figure's grid. The row index starts at 0.colNum
- column index in this Figure's grid. The column index starts at 0.- Returns:
- this Figure with the chart removed.
-
chart
Description copied from interface:BaseFigure
Returns a chart from this Figure's grid.- Specified by:
chart
in interfaceBaseFigure
- Parameters:
index
- index from the Figure's grid to remove. The index starts at 0 in the upper left hand corner of the grid and increases going left to right, top to bottom. E.g. for a 2x2 Figure, the indices would be [0, 1] [2, 3].- Returns:
- selected
Chart
-
chart
Description copied from interface:BaseFigure
Returns a chart from this Figure's grid.- Specified by:
chart
in interfaceBaseFigure
- Parameters:
rowNum
- row index in this Figure's grid. The row index starts at 0.colNum
- column index in this Figure's grid. The column index starts at 0.- Returns:
- selected
Chart
-
save
Description copied from interface:BaseFigure
Saves the Figure as an image.- Specified by:
save
in interfaceBaseFigure
- Parameters:
saveLocation
- save location. Must not be nullwait
- whether to hold the calling thread until the file is writtentimeoutSeconds
- timeout in seconds to wait.- Returns:
- figure
-
save
public BaseFigure save(String saveLocation, int width, int height, boolean wait, long timeoutSeconds)Description copied from interface:BaseFigure
Saves the Figure as an image.- Specified by:
save
in interfaceBaseFigure
- Parameters:
saveLocation
- save location. Must not be nullwidth
- image widthheight
- image heightwait
- whether to hold the calling thread until the file is writtentimeoutSeconds
- timeout in seconds to wait.- Returns:
- figure
-
validateInitialization
public void validateInitialization()Checks if the figure can be instantiated. Throws an error if not.- Throws:
RuntimeException
- if no charts or no plots have been created
-
getPlotInfo
- Specified by:
getPlotInfo
in interfacePlotExceptionCause
-
setName
-
setSessionId
public void setSessionId(int sessionId) -
getName
-
getSessionId
public int getSessionId() -
initializationGate
-
consolidateTableMaps
public void consolidateTableMaps() -
consolidateTables
public void consolidateTables()
-