Class LineChartDrawer<K>

Type Parameters:
K - the type of the keys used to identify the series in the line chart
Direct Known Subclasses:
RolesPopulationLineChartDrawer

public abstract class LineChartDrawer<K> extends Viewer
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.

  • 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 role SimuOrganization.VIEWER_ROLE in the group SimuOrganization.ENGINE_GROUP.

      The GUI is initialized with a LineChart as the central node.

      Overrides:
      onActivation in class Viewer
    • addSerie

      protected void addSerie(K key, String name)
      Adds a new serie to the line chart.
      Parameters:
      key - the key to identify the serie
      name - the name of the serie
    • addData

      public void addData(K key, String x, Number y)
      Adds a new data point to the serie identified by the key.
      Parameters:
      key - the key of the serie
      x - the x value
      y - the y value
    • getLineChartTitle

      protected abstract String getLineChartTitle()
      Returns the title of the line chart.
      Returns:
      the title of the line chart
    • getyAxisLabel

      protected abstract String getyAxisLabel()
      Returns the label of the y-axis of the line chart.
      Returns:
      the label of the y-axis of the line chart
    • getxAxisLabel

      protected abstract String getxAxisLabel()
      Returns the label of the x-axis of the line chart.
      Returns:
      the label of the x-axis of the line chart
    • getLineChart

      protected LineChart<String,Number> getLineChart()
      Returns the line chart node
      Returns:
      the line chart node
    • getSeries

      public Map<K,XYChart.Series<String,Number>> 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