reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
seancorfield 2021-01-03T00:19:32.030400Z

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...

👍 1
phronmophobic 2021-01-03T07:29:43.036100Z

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.

❤️ 4
vlaaad 2021-01-03T19:48:43.036900Z

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)

vlaaad 2021-01-03T19:51:43.037100Z

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

phronmophobic 2021-01-03T19:52:11.037300Z

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

vlaaad 2021-01-03T19:52:34.037500Z

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

phronmophobic 2021-01-03T19:52:56.037700Z

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

phronmophobic 2021-01-03T19:53:09.037900Z

how would I add support for the popup?

phronmophobic 2021-01-03T19:53:17.038100Z

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

vlaaad 2021-01-03T19:53:35.038300Z

does it use cljfx descriptions for rectangles?

phronmophobic 2021-01-03T19:53:55.038500Z

no, everything is drawn in a canvas

phronmophobic 2021-01-03T19:54:29.038700Z

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

phronmophobic 2021-01-03T19:55:31.039Z

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

vlaaad 2021-01-03T19:55:33.039200Z

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)

phronmophobic 2021-01-03T19:55:58.039400Z

getting a value from a mouse click position is pretty easy

vlaaad 2021-01-03T19:56:40.039600Z

then it should be doable!

🤘 1
vlaaad 2021-01-03T19:57:42.039900Z

it will look like that:

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

vlaaad 2021-01-03T19:59:25.040100Z

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

vlaaad 2021-01-03T20:00:42.040300Z

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!

🦜 1
phronmophobic 2021-01-03T20:01:36.040600Z

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

phronmophobic 2021-01-03T20:02:18.040800Z

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

phronmophobic 2021-01-03T20:15:21.041Z

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

phronmophobic 2021-01-03T20:31:56.041400Z

nvmd, figured it out

1
phronmophobic 2021-01-03T20:44:18.041700Z

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

vlaaad 2021-01-03T21:00:07.041900Z

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

vlaaad 2021-01-03T21:00:43.042100Z

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

1
😱 1
phronmophobic 2021-01-03T21:02:04.042500Z

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

phronmophobic 2021-01-03T21:03:06.042700Z

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

phronmophobic 2021-01-03T21:03:39.042900Z

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

phronmophobic 2021-01-03T21:03:59.043100Z

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

vlaaad 2021-01-03T21:04:55.043300Z

No, I don't have anything special wrt exceptions

phronmophobic 2021-01-03T21:05:48.043500Z

maybe I just trigger too many exceptions

😄 1
phronmophobic 2021-01-03T21:10:43.043800Z

ok, new version should support the context menu

phronmophobic 2021-01-03T21:11:20.044Z

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

phronmophobic 2021-01-03T21:11:33.044200Z

just right click and view value

phronmophobic 2021-01-03T21:11:40.044400Z

or right click and treemap again

vlaaad 2021-01-03T21:24:34.044600Z

yeah, recursive inspection FTW!

2021-01-11T14:12:05.068400Z

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