Class AbstractChartGenerator<C extends org.knowm.xchart.internal.chartpart.Chart,D extends Dataset>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.xchart.chart.AbstractChartGenerator<C,D>
-
- Type Parameters:
C- the type of chartD- the type of data
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Serializable
- Direct Known Subclasses:
AbstractChartGeneratorWithAxisLabels
public abstract class AbstractChartGenerator<C extends org.knowm.xchart.internal.chartpart.Chart,D extends Dataset> extends AbstractOptionHandler implements QuickInfoSupporter
Ancestor for chart generators.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Legendwhether to show the legend.protected org.knowm.xchart.style.Styler.LegendPositionm_LegendPositionthe position of the legend.protected Stringm_Titlethe title of the chart.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractChartGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddData(C chart, Datasets<D> data)Adds the data to the chart.protected abstract CbuildChart()Builds the chart.protected Stringcheck(List<D> data)Hook method for checks before generating the chart.voiddefineOptions()Adds options to the internal list of options.protected CdoGenerate(Datasets<D> data)Performs the actual generation of the chart.Cgenerate(Datasets<D> data)Generates the chart.booleangetLegend()Returns whether the legend is displayed.org.knowm.xchart.style.Styler.LegendPositiongetLegendPosition()Returns the position for the legend.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringgetTitle()Returns the title for the plot.StringlegendPositionTipText()Returns the tip text for this property.StringlegendTipText()Returns the tip text for this property.protected voidpostGenerate(C chart, Datasets<D> data)Hook method for after the chart has been generated.voidsetLegend(boolean value)Sets whether the legend is displayed..voidsetLegendPosition(org.knowm.xchart.style.Styler.LegendPosition value)Sets the position for the legend.voidsetTitle(String value)Sets the title for the plot.protected abstract voidstyleChart(C chart, Datasets<D> data)Applies styling to the chart.StringtitleTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Title
protected String m_Title
the title of the chart.
-
m_Legend
protected boolean m_Legend
whether to show the legend.
-
m_LegendPosition
protected org.knowm.xchart.style.Styler.LegendPosition m_LegendPosition
the position of the legend.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setTitle
public void setTitle(String value)
Sets the title for the plot.- Parameters:
value- the title
-
getTitle
public String getTitle()
Returns the title for the plot.- Returns:
- the title
-
titleTipText
public String titleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLegend
public void setLegend(boolean value)
Sets whether the legend is displayed..- Parameters:
value- true if displayed
-
getLegend
public boolean getLegend()
Returns whether the legend is displayed.- Returns:
- true if displayed
-
legendTipText
public String legendTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLegendPosition
public void setLegendPosition(org.knowm.xchart.style.Styler.LegendPosition value)
Sets the position for the legend.- Parameters:
value- the position
-
getLegendPosition
public org.knowm.xchart.style.Styler.LegendPosition getLegendPosition()
Returns the position for the legend.- Returns:
- the position
-
legendPositionTipText
public String legendPositionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Returns:
- null if no info available, otherwise short string
-
check
protected String check(List<D> data)
Hook method for checks before generating the chart.- Parameters:
data- the data to use- Returns:
- null if checks passed, otherwise error message
-
buildChart
protected abstract C buildChart()
Builds the chart.- Returns:
- the chart
-
styleChart
protected abstract void styleChart(C chart, Datasets<D> data)
Applies styling to the chart.- Parameters:
data- the data to will be addedchart- the chart to style
-
addData
protected abstract void addData(C chart, Datasets<D> data)
Adds the data to the chart.- Parameters:
chart- the chart to add the data todata- the data to add
-
postGenerate
protected void postGenerate(C chart, Datasets<D> data)
Hook method for after the chart has been generated.
Default implementation does nothing.- Parameters:
chart- the chart to add the data todata- the data to add
-
doGenerate
protected C doGenerate(Datasets<D> data)
Performs the actual generation of the chart.- Parameters:
data- the data to use- Returns:
- the chart
-
-