Fork me on GitHub
#reveal
<
2021-01-03
>
seancorfield00:01:32

Nice article @vlaaad -- I'll have to dig deeper into the Figwheel machinery to see if can figure out a way to hook into what it is doing...

👍 3
phronmophobic07:01:43

I just added cljfx support to my ui library and thought it would be fun to test by writing a reveal plugin. Creating the reveal plugin was surprisingly painless. I present reveal-treemap (https://github.com/phronmophobic/reveal-treemap) which offers a treemap reveal action to visualize arbitrary data structures as a treemap. I couldn't find any best practices for offering reveal plugins, but all you need to do is include the dependency and require the appropriate namespace. One of my biggest gripes with reveal is that I wish it had a better view for displaying exceptions so I'll probably try that next.

❤️ 13
vlaaad19:01:43

Found the time to try it out, very interesting way to visualize arbitrary data structures! I found it throws exception when invoking treemap action on "scalar" values (i.e. non-collections: keywords, booleans, numbers)

vlaaad19:01:43

Don't know what I expected trying it on (into {} (map (juxt identity ns-interns) (all-ns))) 😆

phronmophobic19:01:11

good point. I should change it to not be an available action for scalars

vlaaad19:01:34

Would be cool to have Reveal popup there as well to get back to values

phronmophobic19:01:56

the key idea is to try to summarize a datastructure using some bounded number of pixels and I think there's still lots of room for improvement

phronmophobic19:01:09

how would I add support for the popup?

phronmophobic19:01:17

that doesn't seem like it would be hard to add

vlaaad19:01:35

does it use cljfx descriptions for rectangles?

phronmophobic19:01:55

no, everything is drawn in a canvas

phronmophobic19:01:29

but the events for which values you're hovering over bubble all the way up

phronmophobic19:01:31

so if there's a function I can call or some meta data I can set on the canvas as you move the mouse, then that would be easy to do

vlaaad19:01:33

ah, that might be a bit more complex... there is vlaaad.reveal.ext/popup-view cljfx component, in case of canvas you'll need to provide a way to get a value from something like mouse click position (see :select option)

phronmophobic19:01:58

getting a value from a mouse click position is pretty easy

vlaaad19:01:40

then it should be doable!

metal 3
vlaaad19:01:42

it will look like that:

{:fx/type rx/popup-view
 :select (fn [jfx-event] ....)
 :desc {:fx/type your-tree-map-view ...}}

vlaaad19:01:25

jfx event is hmm... can be ContextMenuEvent for right-clicks or KeyEvent if space is pressed

vlaaad20:01:42

Anyway, it's very cool, with Reveal I hoped to make this kind of visualization tooling practical for ad-hoc use! This makes me happy!

parrot 3
phronmophobic20:01:36

if you have any suggestions for different variations for the treemap, it's definitely a topic I'm interested in exploring

phronmophobic20:01:18

basically, I want something general like pprint, but better at summarizing in a reasonable size space for mediumish size data structures

phronmophobic20:01:21

I'm receiving the event, but I'm not sure what I'm supposed to provide for the :bounds key :bounds (required) - JavaFX screen Bounds of a node that will show the popup

phronmophobic20:01:56

nvmd, figured it out

bananadance 3
phronmophobic20:01:18

there's something deep about working on a reveal action using reveal to debug my reveal view

vlaaad21:01:07

hehe, sometimes it is like that when developing reveal in reveal

vlaaad21:01:43

sometimes it's frustrating when I break reveal and can't see the error because reveal is broken 😂

😱 3
3
phronmophobic21:01:04

do you do anything special with your reveal set up for visualizing exceptions?

phronmophobic21:01:06

I still find I prefer the viewing the exception in the emacs cider buffer since I'm better at navigating in emacs

phronmophobic21:01:39

I was thinking of trying to do a reveal action that would try to limit the stack trace to functions in the current code base

phronmophobic21:01:59

and allow you to hover over the stack trace lines to show the surrounding code

vlaaad21:01:55

No, I don't have anything special wrt exceptions

phronmophobic21:01:48

maybe I just trigger too many exceptions

😄 3
phronmophobic21:01:43

ok, new version should support the context menu

phronmophobic21:01:20

I was thinking that it would be cool to add a zoom feature to the treemap, but now I don't have to since you kinda get it for free with the reveal context menu

phronmophobic21:01:33

just right click and view value

phronmophobic21:01:40

or right click and treemap again

vlaaad21:01:34

yeah, recursive inspection FTW!

Affan Salman14:01:05

@U7RJTCH6J Excellent; I can see myself using this. Thanks for sharing!