diff options
Diffstat (limited to 'webstats/stats.paren')
-rw-r--r-- | webstats/stats.paren | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/webstats/stats.paren b/webstats/stats.paren index b9d3974..4721272 100644 --- a/webstats/stats.paren +++ b/webstats/stats.paren @@ -38,6 +38,24 @@ ((@ r text)))) (then (@ console log))))) +(defun response-to-json (response) + (if (@ response ok) + (chain response (json)) + (throw (new (-error "not 2XX resp"))))) + +(defun plot (data) + (new + (u-plot + (create + :title "Site activity visits" + :width 450 + :height 400 + :cursor (create sync (create key "moo")) + :series (list (create label "Time") + (create label "visits" stroke "red"))) + data + (chain document (get-element-by-id "graph"))))) + (add-event-listener "load" (lambda () |