Search in sources :

Example 1 with AxesChartStyler

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();
    });
}
Also used : XYChart(org.knowm.xchart.XYChart) AxesChartStyler(org.knowm.xchart.style.AxesChartStyler) XChartPanel(org.knowm.xchart.XChartPanel)

Aggregations

XChartPanel (org.knowm.xchart.XChartPanel)1 XYChart (org.knowm.xchart.XYChart)1 AxesChartStyler (org.knowm.xchart.style.AxesChartStyler)1