JavaFX LineChart

The JavaFX LineChart can draw line charts inside your JavaFX applications. The JavaFX LineChart component is represented by the class javafx.scene.chart.LineChart .

LineChart X Axis and Y Axis

A JavaFX LIneChart draws a line chart. A line chart is a two-dimensional graph, meaning the graph has an X axis and a Y axis. Line charts typically have two numerical axes. A numerical axis is represented by the JavaFX class javafx.scene.chart.NumberAxis .

You need to define the X axis and Y axis used by a LineChart . Here is an example of creating two JavaFX NumberAxis instances:

Creating a LineChart

You create a JavaFX LineChart component by creating an instance of the LineChart class. You need to pass an X axis and Y axis to the LineChart constructor. Here is a JavaFX LineChart instantiation example:

LineChart Data Series

To get a JavaFX LineChart component to display any dots, you must provide it with a data series . A data series is a list of data points. Each data point contains an X value and a Y value. Here is an example of creating a data series and adding it to a LineChart component: