Created
January 22, 2009 20:52
-
-
Save LauJensen/50711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Burn down chart, input something like "200 175 160 155 152" | |
;; This relies on Dejcartes which is out in "Super pre-alpha". | |
;; Much credit and praise to Chouser for ping-ponging with me on this. | |
(require '[com.markmfredrickson.dejcartes :as chart]) | |
(import '(org.jfree.chart ChartFrame)) | |
(defn make-window [title chart] | |
(doto (ChartFrame. title chart) | |
.pack | |
(.setVisible true))) | |
(defn mean-slope | |
[slope] | |
(int (/ (- (first slope) (last slope)) | |
(dec (count slope))))) | |
(defn decreasing | |
[angle start n] | |
(take n (iterate #(max 0 (- % angle)) (- start angle)))) | |
(defn same-size [& cols] | |
(let [size (reduce max (map count cols))] | |
(apply interleave | |
(map #(concat % (decreasing (mean-slope %) (last %) (- size (count %)))) cols)))) | |
(defn main | |
[] ; 124 86 75 | |
(let [dates (into [] (range 1 21)) ;; Change to length of sprint | |
units (map #(Integer. %) (apply vector | |
(.split (javax.swing.JOptionPane/showInputDialog "Progress:") " "))) | |
slope (same-size units dates)] | |
(make-window "Burn-down chart" | |
(chart/line "Project 1" "Days" "Units" | |
(apply array-map (same-size dates units)))))) | |
(main) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment