use of org.knowm.xchart.style.AxesChartStyler in project skeleton-sp18 by Berkeley-CS61B.
the class GeneratorAudioAnimator method drawAndPlay.
public void drawAndPlay(int numSamplesDraw, int numSamplesPlay) {
chart = QuickChart.getChart("Wave Animator", "Time", "Value", "wave", new double[] { 0 }, new double[] { 0 });
AxesChartStyler chartStyler = chart.getStyler();
chartStyler.setYAxisMin(-1.0);
chartStyler.setYAxisMax(1.0);
chartStyler.setXAxisTicksVisible(false);
frame = new JFrame("XChart");
XChartPanel<XYChart> panel = new XChartPanel<>(chart);
frame.add(panel);
frame.pack();
frame.setVisible(true);
javax.swing.SwingUtilities.invokeLater(() -> {
Animator animator = new Animator(numSamplesDraw, numSamplesPlay);
animator.execute();
});
}
Aggregations