Fork me on GitHub
#datavis
<
2021-09-22
>
Ben Sless08:09:29

damn I just can't get it to work

metasoarous18:09:33

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

metasoarous18:09:11

Well, I guess I can just use that gist

metasoarous18:09:33

@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

metasoarous18:09:59

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

metasoarous23:09:23

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

metasoarous18:09:44

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

metasoarous18:09:02

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.

metasoarous18:09:22

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

metasoarous18:09:25

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.

metasoarous18:09:57

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

metasoarous18:09:50

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.

metasoarous18:09:06

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