Class AbstractChartDataConsumer
- java.lang.Object
-
- jadex.commons.SimplePropertyObject
-
- jadex.extension.envsupport.evaluation.AbstractChartDataConsumer
-
- All Implemented Interfaces:
IPropertyObject
,ITableDataConsumer
- Direct Known Subclasses:
CategoryChartDataConsumer
,HistogramDataConsumer
,TimeChartDataConsumer
,XYChartDataConsumer
public abstract class AbstractChartDataConsumer extends SimplePropertyObject implements ITableDataConsumer
Abstract base class for chart consumers.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jfree.chart.JFreeChart
chart
The chart.-
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
-
-
Constructor Summary
Constructors Constructor Description AbstractChartDataConsumer()
Create a new chart consumer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addValue(java.lang.Comparable seriesname, java.lang.Object valx, java.lang.Object valy, DataTable data, java.lang.Object[] row)
Add a value to a specific series of the chart.void
consumeData(long currenttime, double tick)
Consume data from the provider.protected abstract org.jfree.chart.JFreeChart
createChart()
Create a chart with the underlying dataset.org.jfree.chart.JFreeChart
getChart()
Get the chart.javax.swing.JPanel
getChartPanel()
Get the chart panel.protected ResourceInfo
getResourceInfo(java.lang.String name, java.lang.String[] imports, java.lang.ClassLoader classloader)
Find the file for a given name.AbstractEnvironmentSpace
getSpace()
Get the space.protected ITableDataProvider
getTableDataProvider()
Get the table data provider.protected java.lang.Object[]
getValues(int num, DataTable data, java.lang.Object[] row, SimpleValueFetcher fetcher)
Get the x/y values for a specific series number.void
refresh()
Refresh the chart.-
Methods inherited from class jadex.commons.SimplePropertyObject
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jadex.commons.IPropertyObject
getProperty, getPropertyNames, hasProperty, setProperty
-
-
-
-
Method Detail
-
consumeData
public void consumeData(long currenttime, double tick)
Consume data from the provider.- Specified by:
consumeData
in interfaceITableDataConsumer
- Parameters:
currenttime
- The current time.tick
- The current tick.
-
getValues
protected java.lang.Object[] getValues(int num, DataTable data, java.lang.Object[] row, SimpleValueFetcher fetcher)
Get the x/y values for a specific series number. In case of a multi series the row array defines the specific data to read.
-
getChart
public org.jfree.chart.JFreeChart getChart()
Get the chart.- Returns:
- The chart.
-
refresh
public void refresh()
Refresh the chart.
-
getSpace
public AbstractEnvironmentSpace getSpace()
Get the space.- Returns:
- The space.
-
getTableDataProvider
protected ITableDataProvider getTableDataProvider()
Get the table data provider.- Returns:
- The table data provider.
-
getResourceInfo
protected ResourceInfo getResourceInfo(java.lang.String name, java.lang.String[] imports, java.lang.ClassLoader classloader) throws java.lang.Exception
Find the file for a given name.- Parameters:
name
- The filename or logical name (resolved via imports and extension).extension
- The required extension.imports
- The imports, if any.- Returns:
- The resource info identifying the file.
- Throws:
java.lang.Exception
-
getChartPanel
public javax.swing.JPanel getChartPanel()
Get the chart panel.- Returns:
- The chart panel.
-
createChart
protected abstract org.jfree.chart.JFreeChart createChart()
Create a chart with the underlying dataset.- Returns:
- The chart.
-
addValue
protected abstract void addValue(java.lang.Comparable seriesname, java.lang.Object valx, java.lang.Object valy, DataTable data, java.lang.Object[] row)
Add a value to a specific series of the chart.- Parameters:
seriesname
- The seriesname.valx
- The x value.valy
- The y value.data
- The data table.row
- The current data row.
-
-