code: public static void showChart(
        String name, String xAxis, String yAxis1, XYDataset dataset1, String yAxis2,
        XYDataset dataset2
    ) {
      final JFreeChart chart = createChart(name, xAxis, yAxis1, dataset1, yAxis2, dataset2);
      final ChartPanel chartPanel = createPanel(chart);
  
      final ApplicationFrame app = new ApplicationFrame(name);
  
      chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
      app.setContentPane(chartPanel);
      app.pack();
  
      RefineryUtilities.centerFrameOnScreen(app);
  
      app.setVisible(true);
    }
docs: Starting point for the demonstration application.