Fork me on GitHub
Ben Sless08:09:29

damn I just can't get it to work


Hmm... wanna throw a spec up on a vega editor url?


Well, I guess I can just use that gist


@ben.sless Oh; This turns out to be a very simple mistake. You put the transform in the encoding specification. It should be at the top level (or on the layer specification if you have multiple layers).

Ben Sless18:09:44

I knew it would end up being a silly mistake

Ben Sless18:09:00

I even read the logs but for some reason didn't put 2+2 together


You're quite welcome ­čÖé I've been in the same place, so happy to help.

Ben Sless18:09:39

The problem with the schema it only tells me the path, not what the expected schema is

Ben Sless18:09:26

Maybe I'll use malli to translate the spec


That would be fantastic! I've thought about translating into spec or something like malli. That would be fantastic.

Ben Sless05:09:31

currently malli has no means to read consume json schemas, though, need to PR it


Yeah; Might be appropriate as a separate project frankly. But absolutely seems doable.


This is really one of the big challenges of getting used to vega/vega-lite early on. It's takes time to get a deep intuitive sense of what goes where. You see code in one situation, and in adapting it's usually not immediately obvious which pieces need to go where.


I'll just say that this does get better over time.


However, it's worth pointing out that the vega-editor can often be super helpful. In this case, you'll notice in the logs that you get [Warning] transform-encoding is dropped as transform is not a valid encoding channel.


Also, [Warning] Validation: /encoding must NOT have additional properties of #/additionalProperties


I really should try to add some better debugging information like this to Oz. I'm actually not sure how to though; I don't know that it's code in the vega/vega-lite, but might be using their json-schema to produce this stuff.


Here's my edits; All I changed other than moving transform around was switching to {:filter {:param :selection}}, but your expression approach should work as well (though I'm not sure if selection_rate would be the right way to access the currently selected value or not; would have to look in to that).