Like any other two-axis chart, the line chart has the x axis and y axis. These axes can be of string types or numeric. String values are represented by javafx.scene.chart.CategoryAxis and numeric values by javafx.scene.chart.NumberAxis.
A new LineChart is created by providing the x axis and y axis objects as parameters to its constructor:
final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); xAxis.setLabel("Category"); yAxis.setLabel("Price"); final LineChart<String,Number> lineChart = new LineChart<>(xAxis,yAxis);
Data to LineChart is provided in the form of an instance of XYChart.Series. So, if LineChart uses String on the x axis and Number on the y axis, then we create an instance of ...