(defn area-chart*
([categories values & options]
(let [opts (when options (apply assoc {} options))
data (:data opts)
_values (if (coll? values) (to-list values) ($ values data))
_categories (if (coll? categories) (to-list categories) ($ categories data))
main-title (or (:title opts) "")
theme (or (:theme opts) :default)
_group-by (when (:group-by opts)
(if (coll? (:group-by opts))
(to-list (:group-by opts))
($ (:group-by opts) data)))
x-label (or (:x-label opts) (str 'categories))
y-label (or (:y-label opts) (str 'values))
series-label (:series-label opts)
vertical? (if (false? (:vertical opts)) false true)
legend? (true? (:legend opts))
dataset (DefaultCategoryDataset.)
chart (org.jfree.chart.ChartFactory/createAreaChart
main-title
x-label
y-label
dataset
(if vertical?
org.jfree.chart.plot.PlotOrientation/VERTICAL
org.jfree.chart.plot.PlotOrientation/HORIZONTAL)
legend?
true
false)]
(do
(doseq [i (range 0 (count _values))]
(.addValue dataset
(nth _values i)
(cond
_group-by
(nth _group-by i)
series-label
series-label
:else
(str 'values))
(nth _categories i)))
(set-theme chart theme)
chart))))
Used in 0 other vars
Comments top
No comments for area-chart*. Log in to add a comment.