This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-21
Channels
- # announcements (4)
- # architecture (161)
- # autochrome-github (7)
- # babashka (61)
- # beginners (42)
- # calva (24)
- # cider (22)
- # clj-kondo (28)
- # cljs-dev (8)
- # clojure (88)
- # clojure-art (2)
- # clojure-dev (7)
- # clojure-europe (43)
- # clojure-germany (2)
- # clojure-nl (2)
- # clojure-uk (4)
- # clojurescript (32)
- # core-async (41)
- # cursive (32)
- # datahike (6)
- # datomic (9)
- # emacs (22)
- # events (2)
- # fulcro (10)
- # graphql (1)
- # nextjournal (16)
- # off-topic (9)
- # overtone (1)
- # pathom (16)
- # polylith (5)
- # quil (7)
- # rdf (1)
- # re-frame (7)
- # reagent (22)
- # releases (2)
- # remote-jobs (1)
- # reveal (12)
- # sci (1)
- # shadow-cljs (12)
- # specter (20)
- # sql (6)
- # tools-deps (21)
- # vim (26)
- # xtdb (10)
[showing off] (Almost) full documentation of my clojure2d.color
namespace done in Clerk. Very nice experience: https://clojure2d.github.io/clojure2d/docs/notebooks/index.html#/notebooks/color.clj
Still TODO: correct writing, I'm really bad at this 😕; TOC (pending on Clerk site); tidy up tables
Just made an issue for the "class" problem: https://github.com/nextjournal/clerk/issues/95
Is it possible to get a vega-lite plot using clerk/vl
and have it rendered as SVG (instead of PNG) ?
Zooming into the plots does not look nice :
The rendere seems to support it. Do we have away to configure it ?
you can override the default vega viewer along the lines of https://github.com/nextjournal/clerk/pull/86
I feel so useless in Clojurescript, but maybe some motivation to learn a bit. I came so far, copy from teh exiting VL viewer
(def my-vega {:pred string?
:fetch-fn (fn [_ x] x)
:render-fn '(fn [value]
(v/html
(when value
[v/with-d3-require {:package ["[email protected]"]}
(require '[applied-science.js-interop :as j])
(j/fn [^:js {:keys [embed]}]
[:div {:style {:overflow-x "auto"}}
[:div.vega-lite {:ref #(when % (embed % (clj->js value)))}]])])))})
But then it gave me below exception and I have no clue about it.
The require
statement seems to have passed, but then ???
Error: Could not resolve symbol: j/fn
at new hq ()
at Function.iq.j ()
at Function.iq.h ()
at W6 ()
at Y7 ()
at a8 ()
at oBa ()
at t8 ()
at e8 ()
at
I give up at this point. My ClojureScript knowledge is too rudimentary to translate the "javascript" documentation of Vega on how set the "renderer" to "svg" into the viewer API of Clerk. It is clear, that adding own custom viewers to Clerk, requires very specific knowledge. But I do hope, that a re-usable library of those can be developed over time and simply be used.
But I just discovered that the vega embed options can be added to the vega spec itself:+1: So we can render as svg by adding this to the spec:
:usermeta {:embedOptions {:renderer "svg"}}
But I just discovered that the vega embed options can be added to the vega spec itself:+1: So we can render as svg by adding this to the spec:
:usermeta {:embedOptions {:renderer "svg"}}