Fork me on GitHub
#reveal
<
2021-10-07
>
eval-on-point15:10:07

Does reveal have the ability to live update views on refs? Say I have an atom with a map in it. Can I get a bar chart of the map updating as the value in the atom changes?

vlaaad16:10:57

Yes! vlaaad.reveal.ext/observable-view

eval-on-point16:10:04

😲 next level stuff

vlaaad16:10:32

The future is here

eval-on-point16:10:38

thanks for your work! now I finally have an excuse to dig into cljfx as well :)

vlaaad16:10:10

Here is a small example with bar chart:

(require '[vlaaad.reveal.ext :as rx])

(def x {:a 1 :b 2 :c 4})

(rx/open-view
  {:fx/type rx/observable-view
   :ref #'x
   :fn (fn [m]
         {:fx/type rx/bar-chart-view
          ;; wrap in set because bar-chart-view requires 2 levels of nesting
          :data #{m}})})

;; redefine
(def x {:a 1 :b 2 :c -1})

vlaaad16:10:09

my pleasure!