Open Drup opened 9 years ago
Note that there is a bug I don't understand in https://github.com/Drup/ocaml-d3/commit/439b301ccdd5f9b50384407a15aa561c14eeef99 It only colors one rectangle, not all of them.
I'm gonna take a look at this later tonight or tomorrow.
Might be "getting" tyxml a bit more after browsing this. More soon.
Note that the example is quite contrived on purpose (in order to test both inject
and d3
).
Rebased.
In fact, the enter stuff doesn't really work and I can't manage to fix it properly. I tried to use append
but without success. Do you have any propositions ?
First two commits are from #10
It seems that this iteration of the interface doesn't explode too easily, so there we go!
It handles both usual selection and enter selection (with a hack). It allows both to put tyxml in d3 and d3 in tyxml (although you can break typing that way, see later).
The way to use this is the following: you create a function producing tyxml elements depending on data. Both the elements and the layout can change depending on the data. Deep hierarchy works fine.
Then you turn it into a d3 element:
d3 f
At the moment, since tyxml element don't carry the type of data with them, it's possible to break typing by doing :
d3 (inject ...)
. I'm not sure how I feel about that ...