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)
(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.
JSON interpretation of most recent EDN Vega spec passed to Waqi.
JSON interpretation of most recent EDN Vega spec passed to Waqi.
Minimal Vega-Lite spec to show while loading user specs.
Minimal Vega-Lite spec to show while loading user specs.
(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.
(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.
(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.
(plot!* vega-spec)
Minimal Vega-Lite spec to show when page first loads.
Minimal Vega-Lite spec to show when page first loads.
Webserver: info & function to stop webserver.
Webserver: info & function to stop webserver.
(start-server!)
(start-server! port)
Setup fn.
port
or 8080
(stopping any existing Waqi webservers)page
in your browser to receive Vega specsSetup 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.
(stop-server!)
Tear-down fn.
Stops Waqi webserver and nil
ifies related vars.
Tear-down fn. Stops Waqi webserver and `nil`ifies related vars.
WebSocket channel for sending Vega specs to the browser.
WebSocket channel for sending Vega specs to the browser.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close