diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-02-10 03:01:52 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-02-10 03:01:52 +0100 |
commit | 30627e57593c4533b7d1cd49168e22f05a91d759 (patch) | |
tree | 1088c2718d8c129d841cae7260e73a182687325b | |
parent | 0967597ff39c925bd746223b994922e632a0c98e (diff) | |
download | scratch-30627e57593c4533b7d1cd49168e22f05a91d759.tar.gz scratch-30627e57593c4533b7d1cd49168e22f05a91d759.tar.bz2 scratch-30627e57593c4533b7d1cd49168e22f05a91d759.zip |
plot in activity in bars
-rw-r--r-- | webstats/stats.paren | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/webstats/stats.paren b/webstats/stats.paren index 43c1be4..ca61938 100644 --- a/webstats/stats.paren +++ b/webstats/stats.paren @@ -44,8 +44,8 @@ (chain response (json)) (throw (new (-error "not 2XX resp"))))) -(defun spaced-color (idx) - (concatenate 'string "hsl(" (* 137.506 idx) ",70%,55%)")) +(defun spaced-color (idx &optional (opacity 1)) + (concatenate 'string "hsl(" (* 137.506 idx) ",70%,55%," opacity ")")) (defun plot (data) (new @@ -61,19 +61,27 @@ (chain document (get-element-by-id "graph"))))) (defun plot-site (data) - (new - (u-plot - (create - :title "Individual Site activity visits" - :width 450 - :height 400 - :cursor (create sync (create key "moo")) - :series (list (create label "Time") - (create label "stats" stroke (spaced-color 0)) - (create label "proxy" stroke (spaced-color 1)) - (create label "blog" stroke (spaced-color 2)))) - data - (chain document (get-element-by-id "graph"))))) + (let ((bars ((@ u-plot paths bars) + (create align 1 gap 0 size (list 0.8 -infinity))))) + (new + (u-plot + (create + :title "Individual Site activity visits" + :width 450 + :height 400 + :cursor (create sync (create key "moo")) + :series (list (create label "Time") + (create label "stats" stroke (spaced-color 0) + fill (spaced-color 0 0.2) + paths bars) + (create label "proxy" stroke (spaced-color 1) + fill (spaced-color 1 0.2) + paths bars) + (create label "blog" stroke (spaced-color 2) + fill (spaced-color 2 0.2) + paths bars))) + data + (chain document (get-element-by-id "graph")))))) (add-event-listener "load" |