!7 lib 1400104 // XChart import org.knowm.xchart.*; sclass XChartRealTimeTest > DynModule { transient double phase = 0; JComponent visualize() { double[][] initdata = getSineData(phase); // Create Chart final XYChart chart = QuickChart.getChart("Simple XChart Real-time Demo", "Radians", "Sine", "sine", initdata[0], initdata[1]); final JComponent panel = new XChartPanel(chart); awtEvery(panel, 200, r { phase += 2 * Math.PI * 2 / 20.0; double[][] data = getSineData(phase); chart.updateXYSeries("sine", data[0], data[1], null); revalidate(panel); }); ret panel; } double[][] getSineData(double phase) { double[] xData = new double[100]; double[] yData = new double[100]; for i over xData: { double radians = phase + (2 * Math.PI / xData.length * i); xData[i] = radians; yData[i] = Math.sin(radians); } ret new double[][] { xData, yData }; } }