I'm trying to embedded a XChart panel in a JavaFX application.
For that I'm trying to use a swing node to add to it a xChart panel. So far it works, I can see the chart.
The problem is that I need to update it in realtime every 50 ms and if I try to add the data to the chart it won't update it until later.
final XYChart chart = QuickChart.getChart("Simple XChart Real-time Demo", "Radians", "Sine", "sine", initdata[0], initdata[1]);
JPanel pnlChart = new XChartPanel(chart);
If I use a SwingWrapper:
final SwingWrapper<XYChart> sw = new SwingWrapper<XYChart>(chart);
sw.displayChart();
and use sw.repaintChart():
Platform.runLater(() -> chart.updateXYSeries("sine", data[0], data[1], null));
sw.repaintChart();
It works but the swing Wrapper creates its own window.
How could I update the data in the embedded chart instead?
Thank you.