diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-02-10 02:08:51 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-02-10 02:08:51 +0100 |
commit | 0967597ff39c925bd746223b994922e632a0c98e (patch) | |
tree | b732389062227b84aedce0d5044cd4d68c9ceb1d /webstats/stats.paren | |
parent | 7b90ec0b14a0114f055a26e2f29f92a3f771c87e (diff) | |
download | scratch-0967597ff39c925bd746223b994922e632a0c98e.tar.gz scratch-0967597ff39c925bd746223b994922e632a0c98e.tar.bz2 scratch-0967597ff39c925bd746223b994922e632a0c98e.zip |
stats for separate domains
Diffstat (limited to 'webstats/stats.paren')
-rw-r--r-- | webstats/stats.paren | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/webstats/stats.paren b/webstats/stats.paren index 6491020..43c1be4 100644 --- a/webstats/stats.paren +++ b/webstats/stats.paren @@ -44,6 +44,9 @@ (chain response (json)) (throw (new (-error "not 2XX resp"))))) +(defun spaced-color (idx) + (concatenate 'string "hsl(" (* 137.506 idx) ",70%,55%)")) + (defun plot (data) (new (u-plot @@ -57,8 +60,27 @@ data (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"))))) + (add-event-listener "load" (lambda () (instrument-links) - (register-page-load))) + (register-page-load) + + (ps:chain (fetch "/stats/metric.json?q=split") + (then #'response-to-json) + (then #'plot-site)))) |