         (.setSeriesLinesVisible 0 false)
         (.setSeriesShapesVisible 0 true)))))
 
-(defmethod chart CategoryDataset [dataset]
-  (doto (ChartFactory/createLineChart "Population Analysis" "Generation" "Fitness" dataset)
-    (->
-      (.getCategoryPlot)
-      (.getRenderer)
-      (.setShapesVisible true))))
+(defmethod chart BoxAndWhiskerCategoryDataset [dataset]
+  (ChartFactory/createBoxAndWhiskerChart "Population Analysis" "Generation" "Fitness" dataset false))
 
 (defn- panel [chart]
   (doto (ChartPanel. chart)

  (doto (XYSeriesCollection. (XYSeries. "Individual"))
    (.addSeries (DatasetUtilities/sampleFunction2DToSeries (->Function2D f) min max samples "Value"))))

(defn- log-generation
  ([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)))

(defn logger
  ([]
   (let [analysis-dataset (DefaultCategoryDataset.)]
     (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.)]
     (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.function Function2D]
           [org.jfree.data.general DatasetUtilities]
           [org.jfree.data.xy XYSeries XYSeriesCollection]
           [org.jfree.data.statistics BoxAndWhiskerCategoryDataset DefaultBoxAndWhiskerCategoryDataset]))

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

(defmulti ^:private chart class)

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