1.2.3-SNAPSHOT permalink Arrow_down_16x16

line-chart*

incanter.charts

  • (line-chart* categories values & options)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/charts.clj:1300 top

(defn line-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) "")
	  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)
	  theme (or (:theme opts) :default)
	  legend? (true? (:legend opts))
	  dataset (DefaultCategoryDataset.)
	  chart (org.jfree.chart.ChartFactory/createLineChart
		 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))))
Vars in incanter.charts/line-chart*: cond defn doseq group-by let nth str
Used in 0 other vars

Comments top

No comments for line-chart*. Log in to add a comment.