Class Graph
java.lang.Object
view.Graph
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
ConstructorsConstructorDescriptionGraph(javafx.scene.canvas.Canvas canvas, int maxPoints) Creates a graph renderer bound to the given canvas and starts automatic repainting. -
Method Summary
-
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 surfacemaxPoints- 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
-