gadfly361 / rid3

Reagent Interface to D3
MIT License
142 stars 6 forks source link

Why is the data passed to :elem-with-data required to be in ":dataset" #6

Closed rasensio1 closed 6 years ago

rasensio1 commented 6 years ago

Maybe this is a d3 thing (I'm not very familiar with d3), but I was pretty stumped for a while before I figured out that the data passed to the vis, to be used for :elem-with-data elements must be nested in a k-v pair, with the key being ":dataset".

Maybe it would be good to add this to the docs, or instead, to be able to declare which key the data is in, somewhere in the vis options.

Cheers!

gadfly361 commented 6 years ago

@rasensio1 Not a d3 thing, just a convention I am using. It is documented in the default for prepare-dataset ... but admittedly not very well. Probably should call it out as a bullet point. You can, of course, change where your data lives for :elem-with-data pieces, which is nice, because different pieces can rely on different things or different parts of the data.

If you are open to it, I would happy to merge in a PR to help document this default :)

rasensio1 commented 6 years ago

Okedoke! That clears it up for me. I would be glad to make a PR once I poke around a bit more. Cheers.

What you pointed out just made what I'm doing so much easier! Awesome :) Really liking this tool.