Javatpoint Logo
Javatpoint Logo

JavaFX LineChart

In general, the Line Chart is defined as the type of graph in which the group of data points called markers are used to display the information.

In Line Chart, the markers are plotted on the mapping points between the two Number axes. The markers are connected by the line segments. Basically, the line chart shows the deviation in the values of one axis with respect to the change in values of other axis.

In the following image, the line chart shows the variation in the price of Milk over the last 8 years. On the Y axis, the price is shown while on the X axis, the years are shown.

JavaFX LineChart1

In JavaFX, the Line Chart is represented by the class javafx.scene.chart.LineChart


The properties of the class along with the setter methods are described in the following table.

Property Description Setter Methods
axisSortingPolicy This is an LineChart.SortingPolicy type property. It represents whether the data is to be sorted according the nature of one of the axis. setAxisSortingProperty(LineChart.SortingPolicy value)
createSymbols This is a boolean type property. It represents whether the symbols are needed to be created for the ones for which the symbol nodes are not specified. setCreateSymbols(Boolean true)


There are two constructors in the class.

  1. public LineChart(Axis Xaxis, Axis Yaxis ) : creates a new instance of LineChart with the specified axis.
  2. public LineChart(Axis Xaxis, Axis Yaxis, ObservableList> data) : creates the new instance of LineChart with the specified axis and data


In the following example, we have shown the variation in the share price of a stock in the different years.

JavaFX LineChart2
Next TopicJavaFX Area Chart

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA