Class Distribution

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget, ProvidesResize, RequiresResize, AbstractGraph.Controller, GenericPopGraph.PopGraphController, TooltipProvider, TooltipProvider.Index, ChangeListener, MilestoneListener, BasicTooltipProvider

public class Distribution extends AbstractView implements GenericPopGraph.PopGraphController, TooltipProvider.Index
The view to display the distribution of continuous traits. For a single trait the histrogram of trait densities is shown as a heatmap over time. For two traits a 2D distribution is shown and for multiple traits the traits shown along the horizontal and vertical axis can be selected.
Author:
Christoph Hauert
  • Field Details

    • graphs

      protected List<PopGraph2D> graphs
      The list of graphs that display the trajectories in 2D phase planes.
      Implementation Notes:
      List<ParaGraph> graphs is deliberately hiding List<AbstractGraph> graphs from the superclass because it saves a lot of ugly casting. Note that the two fields point to one and the same object.
    • MAX_BINS

      protected int MAX_BINS
      The maximum number of bins for the trait histograms.
    • bins

      double[] bins
      The storage to accommodate the trait histograms.
    • traitXIdx

      int traitXIdx
      The index of the trait to be shown along the x-axis.
    • traitYIdx

      int traitYIdx
      The index of the trait to be shown along the y-axis.
    • traitXItems

      private ContextMenuCheckBoxItem[] traitXItems
      The context menu for selecting traits to display on the horizontal axis.
    • traitYItems

      private ContextMenuCheckBoxItem[] traitYItems
      The context menu for selecting traits to display on the vertical axis.
    • traitXMenu

      private ContextMenu traitXMenu
      The context menu trigger for selecting traits to display on the horizontal axis.
    • traitYMenu

      private ContextMenu traitYMenu
      The context menu trigger for selecting traits to display on the vertical axis.
  • Constructor Details

    • Distribution

      public Distribution(EvoLudoGWT engine, Data type)
      Construct a new view to display the distribution of continuous traits of the current EvoLudo model.
      Parameters:
      engine - the pacemaker for running the model
      type - the type of data to display
  • Method Details

    • getName

      public String getName()
      Description copied from class: AbstractView
      Get the name of this view. This is used to dynamically build the view selector.
      Specified by:
      getName in class AbstractView
      Returns:
      the name of this view
    • clear

      public void clear()
      Description copied from class: AbstractView
      Clear the view.
      Overrides:
      clear in class AbstractView
    • allocateGraphs

      protected void allocateGraphs()
      Description copied from class: AbstractView
      Allocate all graphs managed by this view. This is called when loading the view. Once all views are attached to the browser DOM a call to the graph's calcBounds(int, int) is triggered through setBounds(int, int) to properly calculate the layout.
      Specified by:
      allocateGraphs in class AbstractView
      See Also:
    • reset

      public void reset(boolean hard)
      Description copied from class: AbstractView
      Called when a module has been reset. All graphs are reset and updated if needed, unless hard is true.
      Overrides:
      reset in class AbstractView
      Parameters:
      hard - the flag to indicate whether to do a hard reset
    • modelDidInit

      public void modelDidInit()
      Description copied from interface: MilestoneListener
      Called after the EvoLudo model got re-initialized.
      Specified by:
      modelDidInit in interface MilestoneListener
      Overrides:
      modelDidInit in class AbstractView
    • update

      public void update(boolean force)
      Description copied from class: AbstractView
      Called when the view needs updating. This gets called when the selected view changed or new data is available from the model. Views may ignore updating requests unless force is true.
      Specified by:
      update in class AbstractView
      Parameters:
      force - true to force the update
    • createGeometry

      private Geometry createGeometry(int nTraits)
      Create a geometry for the given number of traits. Utility method to generate a linear geometry (with history) for a single trait and a 2D square lattice for multiple traits.
      Parameters:
      nTraits - the number of traits
      Returns:
      the geometry
    • getTooltipAt

      public String getTooltipAt(AbstractGraph<?> graph, int node)
      Description copied from interface: TooltipProvider.Index
      Get the tooltip for the location with index index.
      Specified by:
      getTooltipAt in interface TooltipProvider.Index
      Parameters:
      graph - the graph requesting the tooltip
      node - the index of the location
      Returns:
      the tooltip for the node
      See Also:
    • populateContextMenuAt

      public void populateContextMenuAt(ContextMenu menu, int node)
      Description copied from interface: GenericPopGraph.PopGraphController
      Opportunity for the controller to add functionality to the context menu (optional implementation). Additional entries should be added to menu. If the context menu was opened while the mouse was over a node its index is node. At this point the menu already contains entries that are relevant for all graphs, e.g. fullscreen and export. Override this method to add further, more specialized entries. Finally, the current pane will be asked whether it wants to add further entries (e.g. autoscale axis).
      Specified by:
      populateContextMenuAt in interface GenericPopGraph.PopGraphController
      Parameters:
      menu - the context menu
      node - the index of node
      See Also:
    • exportTypes

      protected AbstractView.ExportType[] exportTypes()
      Description copied from class: AbstractView
      Return the list of export types that are acceptable for _all_ graphs in this view.
      Overrides:
      exportTypes in class AbstractView
      Returns:
      the list of viable export types