Vishal Vishal - 4 months ago 48
HTML Question

d3.js to show a popup window with a form on click of image

My requirement is to show a popup window on click of some image (similar to this How to create a popup window with a form?). The popup window will contain some text fields and submit button. Upon searching, I could see that jquery already provides that feature, but i'm not quite sure if jquery and d3.js works together. Do anyone know this kind of libarries or example source code in d3.js?

Appreciate your help.

Update: I tried integrating the above example with jquery, but then sine d3.js uses svg to draw my objects and login form is inside a div as in example (How to create a popup window with a form?), the window scrolls down looking very bad.

Appreciate any help here.

Answer

Yes Jquery can "work together" in the sense that you can mix the code (ie: use jQuery in a d3.js callback for instance).

Your question is quite vague however, maybe you could precise what you have in mind or have a code snippet? I invite you to consult: https://github.com/d3/d3/wiki/gallery and look for within the numerous D3.js examples see if you find something similar to what you want to achieve.

The way to open a popup would be something like using the D3.js selector, and then using whatever jquery code in the callback function

var svg = d3.select("YourD3Canvas")
            .on("click", function(d) { js or jquery code,  etc... });