JavaFX
To display a chart using a JavaScript charting library you will need to use the WebView component or a third party library such as JxBrowser (commercial).
Java Swing
To display a chart using a JavaScript charting library you will need to use the WebView component or JCEF (Java Chromium Embedded Framework) or a third party library such as JxBrowser (commercial).
WebView
The WebView component with Java 8 is quite old and does not implement all JavaScript features that modern browsers now include. We have noticed a few minor Formatting/Display issues using Highcharts and ApexCharts JavaScript charting libraries with WebView.
There are updated Java 8 and newer builds of OpenJDK available from Azul that also include JavaFX functionality. These versions include an updated WebView component that have better JavaScript support. They are free to download and use.
Note: The Highcharts v11 sonification module does not appear to work with the WebView component.
JCEF
The Java Chromium Embedded Framework (JCEF) is a simple framework for embedding Chromium-based browsers in other applications using the Java programming language. It is a BSD-licensed open source project.
Maven builds of JCEF are available, see JCEF Maven.
As of February 2023 the latest JCEF Maven version included chromium-110.0.5481.78