Class Graph

java.lang.Object
view.Graph

public class Graph extends Object
Renders a continuously updating line chart onto a JavaFX Canvas.

The graph is used by the simulator UI to visualize a moving stream of numeric values, such as the current mid-price during a simulation run. Internally it keeps a sliding window of the latest values up to maxPoints, redraws the canvas on every JavaFX animation pulse, and paints a background grid plus a formatted price axis.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Graph(javafx.scene.canvas.Canvas canvas, int maxPoints)
    Creates a graph renderer bound to the given canvas and starts automatic repainting.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addValue(double value)
    Appends a new value to the graph.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Graph

      public Graph(javafx.scene.canvas.Canvas canvas, int maxPoints)
      Creates a graph renderer bound to the given canvas and starts automatic repainting.
      Parameters:
      canvas - the canvas used as the drawing surface
      maxPoints - the maximum number of recent values kept in memory and shown
  • Method Details

    • addValue

      public void addValue(double value)
      Appends a new value to the graph.

      If the internal buffer grows beyond maxPoints, the oldest value is discarded so the chart remains a fixed-width sliding window.

      Parameters:
      value - the next numeric sample to display