Fork me on GitHub
#nextjournal
<
2022-02-21
>
genmeblog15:02:19

[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

sheepy 5
genmeblog15:02:43

Still TODO: correct writing, I'm really bad at this 😕; TOC (pending on Clerk site); tidy up tables

genmeblog15:02:59

it might be my poor styling, but how to control width of table columns?

genmeblog16:02:58

The other issue I see in rendered static:

genmeblog16:02:22

(document uses caching)

genmeblog16:02:38

And it's really strange: sometimes I have double scrollbar in browser (Edge)

Carsten Behring15:02:12

Is it possible to get a vega-lite plot using clerk/vl and have it rendered as SVG (instead of PNG) ?

Carsten Behring15:02:38

Zooming into the plots does not look nice :

Carsten Behring16:02:00

The rendere seems to support it. Do we have away to configure it ?

mkvlr16:02:52

not currently

mkvlr16:02:06

you can override the default vega viewer along the lines of https://github.com/nextjournal/clerk/pull/86

Carsten Behring18:02:03

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 

Carsten Behring20:02:57

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.

Carsten Behring20:02:42

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"}}

😮 1
💯 6
metal 1
Carsten Behring20:02:42

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"}}

😮 1
💯 6
metal 1