code: public void populationUpdate(final PopulationData<?> populationData)
      {
          SwingUtilities.invokeLater(new Runnable()
          {
              public void run()
              {
                  chart.setNotify(false); // Avoid triggering a redraw for every change we make in this method.
                  if (populationData.getGenerationNumber() == 0)
                  {
                      if (!populationData.isNaturalFitness())
                      {
                          invertCheckBox.setSelected(true);
                      }
                      // The graph might be showing data from a previous run, so clear it.
                      meanSeries.clear();
                      bestSeries.clear();
                  }                
                  meanSeries.add(populationData.getGenerationNumber(), populationData.getMeanFitness());
                  double best = populationData.getBestCandidateFitness();
                  bestSeries.add(populationData.getGenerationNumber(), best);
  
                  // We don't use JFreeChart's auto-range for the axes because it is inefficient
                  // (it degrades linearly with the number of items in the data set).  Instead we track
                  // the minimum and maximum ourselves.
                  double high = Math.max(populationData.getMeanFitness(), populationData.getBestCandidateFitness());
                  double low = Math.min(populationData.getMeanFitness(), populationData.getBestCandidateFitness());
                  if (high > maxY)
                  {
                      maxY = high;
                      rangeAxis.setRange(minY, maxY);
                  }
                  if (low < minY)
                  {
                      minY = low;
                      rangeAxis.setRange(minY, maxY);
                  }
  
                  updateDomainAxisRange();
                  chart.setNotify(true); // Redraw all at once now.
              }
          });
      }
docs: {@inheritDoc}