Liking cljdoc? Tell your friends :D

applied-science.waqi

Data visualizations from Clojure using Vega(-Lite) in the browser.

Waqi workflow is designed for the Clojurist who interacts with their data by iteratively visualizing (parts of) it, with code and resulting Vega-Embed simultaneously in view.

Users evaluate Vega/Vega-Lite specs (as Clojure maps) with plot! to see their data visualized in the browser. If Waqi has not started a server and established a WebSocket connection to a browser, it calls start-server! (with or without a port argument) to do so. If plot! cannot send a WebSocket message it will throw an error.

Architecture is as follows:

[bare-bones HTML page on localhost] ^ | (Vega(-Lite) specs, as JSON, sent via websocket) | v (Vega(-Lite) specs, [http-kit webserver] <--- as Clojure maps, ---- [client] sent via function call)

Data visualizations from Clojure using Vega(-Lite) in the browser.

Waqi workflow is designed for the Clojurist who interacts with their
data by iteratively visualizing (parts of) it, with code and
resulting Vega-Embed simultaneously in view.

Users evaluate Vega/Vega-Lite specs (as Clojure maps) with `plot!`
to see their data visualized in the browser. If Waqi has not started
a server and established a WebSocket connection to a browser, it
calls `start-server!` (with or without a port argument) to do so. If
`plot!` cannot send a WebSocket message it will throw an error.
  
Architecture is as follows:

  [bare-bones HTML page on localhost]
            ^
            |
    (Vega(-Lite) specs,
         as JSON,
     sent via websocket)
            |
            v                  (Vega(-Lite) specs,
    [http-kit webserver] <---    as Clojure maps,     ---- [client]
                              sent via function call)
raw docstring

appclj

(app req)

HTTP request handler. Returns HTML page set up to receive Vega specs over WebSocket, unless the request is a WebSocket message to be sent to that page.

HTTP request handler.
Returns HTML page set up to receive Vega specs over WebSocket,
unless the request is a WebSocket message to be sent to that page.
raw docstring

last-specclj

JSON interpretation of most recent EDN Vega spec passed to Waqi.

JSON interpretation of most recent EDN Vega spec passed to Waqi.
raw docstring

loading-specclj

Minimal Vega-Lite spec to show while loading user specs.

Minimal Vega-Lite spec to show while loading user specs.
raw docstring

pageclj

(page {:keys [port] :as opts})

HTML page to visualize Vega/Vega-Lite specs. Merely a skeleton with Vega and WebSocket connection to Vega-Embed.

HTML page to visualize Vega/Vega-Lite specs.
Merely a skeleton with Vega and WebSocket connection to Vega-Embed.
raw docstring

page-jsclj

(page-js port)

JavaScript snippet for the HTML page. Establishes a WebSocket connection to visualize incoming messages with Vega-Embed.

JavaScript snippet for the HTML page.
Establishes a WebSocket connection to visualize incoming messages
with Vega-Embed.
raw docstring

plot!clj

(plot! vega-spec)
(plot! port vega-spec)

Visualization fn. Sends the given EDN Vega spec to the browser to be visualized. Will start a Waqi server if none exists. Returns map of WebSocket response and Waqi config. Throws an error if WebSocket connection has been lost. Saves each spec to last-spec for debugging purposes.

Note that if the optional port is provided then any Waqi server running on another port will be stopped.

Visualization fn.
Sends the given EDN Vega spec to the browser to be visualized. Will
start a Waqi server if none exists. Returns map of WebSocket
response and Waqi config. Throws an error if WebSocket connection
has been lost. Saves each spec to `last-spec` for debugging
purposes.

Note that if the optional `port` is provided then any Waqi server
running on another port will be stopped.
raw docstring

plot!*clj

(plot!* vega-spec)

ready-specclj

Minimal Vega-Lite spec to show when page first loads.

Minimal Vega-Lite spec to show when page first loads.
raw docstring

serverclj

Webserver: info & function to stop webserver.

Webserver: info & function to stop webserver.
raw docstring

start-server!clj

(start-server!)
(start-server! port)

Setup fn.

  1. Starts Waqi webserver on given port or 8080 (stopping any existing Waqi webservers)
  2. Opens HTML page in your browser to receive Vega specs
  3. Returns map of current setup.
Setup fn.
1. Starts Waqi webserver on given `port` or 8080
   (stopping any existing Waqi webservers)
2. Opens HTML `page` in your browser to receive Vega specs
3. Returns map of current setup.
raw docstring

stop-server!clj

(stop-server!)

Tear-down fn. Stops Waqi webserver and nilifies related vars.

Tear-down fn.
Stops Waqi webserver and `nil`ifies related vars.
raw docstring

ws-chanclj

WebSocket channel for sending Vega specs to the browser.

WebSocket channel for sending Vega specs to the browser.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close