   (doto (XYSeriesCollection. (XYSeries. "Individual"))
     (.addSeries (DatasetUtilities/sampleFunction2DToSeries (->Function2D f) min max samples "Value"))))
 
+(defn- set-individuals [series f population]
+  (doseq [[individual] population]
+    (.add series individual (f individual) false)))
+
 (defn- log-generation
+  ([f generation-series analysis-dataset population generation-number]
+   (doto generation-series
+     (.clear)
+     (set-individuals f population)
+     (.fireSeriesChanged))
+   (log-generation analysis-dataset population generation-number))
   ([analysis-dataset population generation-number]
    (doto analysis-dataset
-     (.addValue (stat/mean-fitness population) "Mean" generation-number)
-     (.addValue (stat/best-fitness population) "Best" generation-number))
-   (Thread/sleep 500))
-  ([f generation-series analysis-dataset population generation-number]
-   (.clear generation-series)
-   (doseq [[individual] population]
-     (.add generation-series individual (f individual)))
-   (log-generation analysis-dataset population generation-number)))
+     (.add (stat/fitness population) "Fitness" generation-number))
+   (Thread/sleep 500)))
 
 (defn logger
   ([]
-   (let [analysis-dataset (DefaultCategoryDataset.)]
+   (let [analysis-dataset (DefaultBoxAndWhiskerCategoryDataset.)]
      (frame "Popluation Analysis" analysis-dataset)
      (partial log-generation analysis-dataset)))
   ([f min max samples]
    (let [sample-dataset (sample f min max samples)
          generation-series (.getSeries sample-dataset "Individual")
-         analysis-dataset (DefaultCategoryDataset.)]
+         analysis-dataset (DefaultBoxAndWhiskerCategoryDataset.)]
      (frame  "Population Analysis" sample-dataset analysis-dataset)
      (partial log-generation f generation-series analysis-dataset))))

  (:require [evolution-programs.util.population-statistic :as stat])
  (:import [javax.swing BoxLayout JFrame]
           [org.jfree.chart ChartFactory ChartPanel StandardChartTheme]
           [org.jfree.data.category CategoryDataset DefaultCategoryDataset]
           [org.jfree.data.function Function2D]
           [org.jfree.data.general DatasetUtilities]
           [org.jfree.data.xy XYDataset XYSeries XYSeriesCollection]))

(ChartFactory/setChartTheme (StandardChartTheme. "JFree/Shadow" true))

(defmulti ^:private chart class)

(defmethod chart XYDataset [dataset]
  (doto (ChartFactory/createXYLineChart "Curve of function" "X" "Y" dataset)
    (->
      (.getXYPlot)

        (.setSeriesLinesVisible 0 false)
        (.setSeriesShapesVisible 0 true)))))

(defmethod chart BoxAndWhiskerCategoryDataset [dataset]
  (ChartFactory/createBoxAndWhiskerChart "Population Analysis" "Generation" "Fitness" dataset false))

(defn- panel [chart]
  (doto (ChartPanel. chart)
