Class LineChartDrawer<K>
java.lang.Object
madkit.kernel.Agent
madkit.simulation.SimuAgent
madkit.kernel.Watcher
madkit.simulation.Viewer
madkit.simulation.viewer.LineChartDrawer<K>
- Type Parameters:
K
- the type of the keys used to identify the series in the line chart
- Direct Known Subclasses:
RolesPopulationLineChartDrawer
A Viewer agent specialized in line chart drawing.
The GUI associated with this agent is a ViewerDefaultGUI
that displays a JavaFX
stage with a LineChart
as the central node. The chart is initialized with a
CategoryAxis
for the x-axis and a NumberAxis
for the y-axis. The axes
labels and the chart title are set by the abstract methods getxAxisLabel()
,
getyAxisLabel()
and getLineChartTitle()
respectively.
-
Nested Class Summary
Nested classes/interfaces inherited from class madkit.kernel.Agent
Agent.ReturnCode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new data point to the serie identified by the key.protected void
Adds a new serie to the line chart.Returns the line chart nodeprotected abstract String
Returns the title of the line chart.int
Returns the maximum number of data points to display on the x-axisReturns the series mapprotected abstract String
Returns the label of the x-axis of the line chart.protected abstract String
Returns the label of the y-axis of the line chart.protected void
This method is called when the agent is activated.void
setMaxXDataPoints
(int maxXDataPoints) Sets the maximum number of data points to display on the x-axisMethods inherited from class madkit.simulation.Viewer
display, getGUI, onEnd, onSimulationStart, render, setGUI
Methods inherited from class madkit.kernel.Watcher
addProbe, getProbes, removeAllProbes, removeProbe, toString
Methods inherited from class madkit.simulation.SimuAgent
createSimuGroup, getCommunity, getEngineGroup, getEnvironment, getLauncher, getModel, getModelGroup, getNextEventDate, getScheduler, getSimuTimer, getViewers, launchAgent, leaveRole, leaveSimuGroup, leaveSimuRole, playRole, prng, requestSimuRole
Methods inherited from class madkit.kernel.Agent
activate, broadcast, broadcastWithRole, broadcastWithRoleWaitForReplies, checkAgentAddress, createGroup, createGroup, createGroup, end, equals, executeThisAgent, executeThisAgent, exitOnKill, getAgentsWithRole, getAgentWithRole, getKernelAddress, getKernelConfig, getLogger, getMailbox, getName, getNetworkID, getOrganization, getReplyTo, handleRequestActionMessage, hashCode, isAlive, killAgent, killAgent, launchAgent, launchAgent, leaveGroup, leaveRole, live, nextMessage, onLive, pause, receiveMessage, reload, reply, replyWithRole, requestRole, requestRole, send, send, sendWaitReply, sendWaitReply, sendWithRole, sendWithRole, sendWithRoleWaitReply, sendWithRoleWaitReply, setupDefaultGUI, waitAnswer, waitAnswer, waitNextMessage, waitNextMessage
-
Constructor Details
-
LineChartDrawer
public LineChartDrawer()
-
-
Method Details
-
onActivation
protected void onActivation()This method is called when the agent is activated. By default, it requests the roleSimuOrganization.VIEWER_ROLE
in the groupSimuOrganization.ENGINE_GROUP
.The GUI is initialized with a
LineChart
as the central node.- Overrides:
onActivation
in classViewer
-
addSerie
-
addData
-
getLineChartTitle
Returns the title of the line chart.- Returns:
- the title of the line chart
-
getyAxisLabel
Returns the label of the y-axis of the line chart.- Returns:
- the label of the y-axis of the line chart
-
getxAxisLabel
Returns the label of the x-axis of the line chart.- Returns:
- the label of the x-axis of the line chart
-
getLineChart
-
getSeries
Returns the series map- Returns:
- the series map
-
getMaxXDataPoints
public int getMaxXDataPoints()Returns the maximum number of data points to display on the x-axis- Returns:
- the maxXDataPoints
-
setMaxXDataPoints
public void setMaxXDataPoints(int maxXDataPoints) Sets the maximum number of data points to display on the x-axis- Parameters:
maxXDataPoints
- the maxXDataPoints to set
-