How to access to `this` of d3.js (svg node) in Clojurescript (Reagent)?

343 views Asked by At

I am using d3.js in a reagent project, and want to convert the Javascript d3.select(this) to ClojureScript. How can I do this?

Here is an example of d3.select(this) in d3.js: line 84 of: http://codepen.io/zyzy5730/pen/JKkWQO?editors=0010

Here is the project and code where I want to add d3.select(this) in Clojurescript: https://github.com/cmal/fcc-voting/blob/master/src/cljs/fcc_voting/views.cljs#L267-L269

I've tried to use this, reagent/current-component, (reagent/argv this) and (this-as this ...) . None of them seems to work.

I googled for some examples, they use d3.js in reagent and use this, but this in the examples are referring to a reagent component or an argument passed to (fn...), but in d3.js when using .on("mouseover", function(){ d3.select(this)...}, this refers to a svg node on which an event being triggered, maybe a rect or a group or something else.

Thanks.

0

There are 0 answers