From 30627e57593c4533b7d1cd49168e22f05a91d759 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Mon, 10 Feb 2025 03:01:52 +0100 Subject: plot in activity in bars --- webstats/stats.paren | 38 +++++++++++++++++++++++--------------- 1 file 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" -- cgit v1.2.3