Fork me on GitHub
#portal
<
2021-12-10
>
Lukas Domagala01:12:10

@juan.ignacio848 the viewer got it’s predicate relaxed. I’ll check what the new one is

nmkip12:12:24

and how do I make it show something? at the moment it's just a blank area

nmkip12:12:27

if I recall correctly, there was a :data param in that body

Lukas Domagala12:12:32

for vega-lite to actually be able to render something you’d need an actually valid vl spec. a tiny one would be this:

{:data
   {:values
    [{:a "A", :b 28}
     {:a "B", :b 55}
     {:a "C", :b 43}
     {:a "D", :b 91}
     {:a "E", :b 81}
     {:a "F", :b 53}]}
:mark "bar"
:encoding
 {:x
   {:field "a"
     :type "nominal"
     :axis {:labelAngle 0}}
    :y {:field "b", :type "quantitative"}}}

nmkip12:12:53

Does it make sense to automatically choose vega viewer when stuff under :data doesnt conform to vega lite spec?

Lukas Domagala13:12:22

my indentation was bad, sorry. the data can be basically map/vector thing, so its hard to spec. and in general vega-lite needs very little in it’s spec, which is why djblue changed it to be more forgiving on the clojure side. the main problem is: you can’t be certain that something is valid vega before passing it into vega, so you want to be relaxed, but then you get false positives, like your case. the best solution would be to a separate predicate for “allowed as viewer” and “default as viewer”, but that’s a project that hasn’t started yet

👍 1
thanks3 1
djblue19:12:37

I think for now, the spec can still be more open but the inspector view could have a higher priority to avoid this issue

djblue19:12:57

If people want to use the vega viewers by default, it can be done via metadata

nmkip12:12:54

Makes sense, :data is a pretty common keyword

Lukas Domagala01:12:37

ah it should “only” kick in when you have a :data attribute

Lukas Domagala12:12:07

so I build a thing to reposition and focus/pull to front the portal instance belonging to the currently focused ide: https://lukas-domagala.de/blog/cljs-to-jxa-for-automation.html

👍 1