I want to plot org.knowm.xchart.XYChart data in same working JFrame but nothing happens in code below:
final XYChart chart = new XYChartBuilder()
.height(jPanel1.getHeight())
.width(jPanel1.getWidth())
.title("test").xAxisTitle("X").yAxisTitle("Y").build();
chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Line);
chart.getStyler().setLegendVisible(false);
for (int i = 0; i < data.length; i++) {
chart.addSeries(data[i], info, xyData[i]);
}
chart.getStyler().setMarkerSize(0);
SwingUtilities.invokeLater(() -> {
jPanel1 = new XChartPanel<>(chart);
jPanel1.invalidate();
});
jPanel1 is anchored in botton of Jframe. All examples of org.knowm.xchart.XYChart show graphs in new window.
I think you need to add his own Panel to yours;
It should work :)