javascript - Style a d3 element with jQuery and CSS -
i have somehow technical question. know if there possibility style d3 element jquery.
for instance "collatz graph" example d3 site http://www.jasondavies.com/collatz-graph/ producing circle - nodes small labels.
in case numbers 1, 2, 3 , on. number nothing more piece of code e.g.
<text dy=".31em" text-anchor="start" transform="rotate(90)translate(8)">32</text>
how style element jquery? e.g. adding red border clicking it?
obviously need class or id in <text ... >
, proceed follows:
$(".nome_class").click(function() { $(this).css( "border", "3px solid red" ); });
in code, both d3 working (i can see graph) , jquery working (i can instance style or else regular html elements). when try style d3 element no result.
i grateful hint or advice.
to cut long answer short: don't it! try searching [svg][jquery] namespace on variety of problems might run when trying use jquery manipulate svg. although there ways around it, of them involve lot of tweaking , doing stuff in pure javascript no jquery involved.
jquery designed handle html results in difficulties dealing other namespaces svg. there bug reports on jquery's bug tracker jquery foundation has closed of them , @ time of writing lists these issues on won't fix page. there good answer question on has been awarded bounty giving more detailed insight technical problems involved.
i have myself combined both jquery , d3 separated use based on purpose designed for: jquery html manipulation , d3 dealing svgs.
Comments
Post a Comment