I'm generating about a hundred of small histograms and would like to show them all at once. My code looks basically like this
(mapv (fn [[data]] (histogram! data))
datas)
(defn histogram! [data]
(clerk/html
{::clerk/width :full}
[:div
[:h3 "Histogram"]
(clerk/vl
{::clerk/width :full}
:data {:values data}
:mark "bar"
:encoding {,,,})]))
WHen it's rendered it shows some of them but the rest is hidden under "76 more..."
Is there a way to expand it automatically?Iirc you might want to try something like:
^{::clerk/page-size nil}
(repeat 100 histogram)But in all above examples, you’d still see the histograms inside a collection viewer.
Maybe clerk/fragment is what you need instead:
(apply clerk/fragment (repeat 100 histogram))
I think maybe you’re looking for
^{:nextjournal.clerk/auto-expand-results? true}
, something like
^{:nextjournal.clerk/auto-expand-results? true}
(mapv (fn [[data]] (histogram! data))
datas)
(defn histogram! [data]
(clerk/html
{::clerk/width :full}
[:div
[:h3 "Histogram"]
(clerk/vl
{::clerk/width :full}
:data {:values data}
:mark "bar"
:encoding {,,,})]))
in your context.More info in the book https://book.clerk.vision/#presentation
Looks like you need to set the viewer budget to infinite (`nil`) too.
^{::clerk/budget nil ::clerk/auto-expand-results? true}
https://book.clerk.vision/#viewer-budget@teodorlu thanks a lot for the advice. I've tried this but for some reason it's not working
^{::clerk/budget nil ::clerk/auto-expand-results? true}
(mapv (fn [...]
(histogram! ...
It still hides the results on the more... button.
I also tried to put it into ns meta
(ns notebooks
{:nextjournal.clerk/visibility {:code :hide :result :show}
:nextjournal.clerk/budget nil :nextjournal.clerk/auto-expand-results? true}
...)
I don’t have any good ideas off the top of my head. Perhaps can a screenshot of your document as rendered by Clerk?
I’ll try to create a minimal reproducer since this is sensitive data and the actual code is a bit more complicated
@andrea712 thanks for the tips - page-size nil finally solved my problem 🙂