tag:blogger.com,1999:blog-279772059074318326.post2683486521831262891..comments2023-12-30T11:14:38.564-08:00Comments on D3.js Tips and Tricks: Select items with an IF statement in d3.jsD3 Noobhttp://www.blogger.com/profile/00927635217604611354noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-279772059074318326.post-13755360497836865502018-03-31T17:54:33.607-07:002018-03-31T17:54:33.607-07:00Hmm... (and please bear in mind that this is untes...Hmm... (and please bear in mind that this is untested);<br /> if (d.title_test) {return "d.title_test"} <br /> else { return "" }<br />D3noobhttps://www.blogger.com/profile/03091573479428198379noreply@blogger.comtag:blogger.com,1999:blog-279772059074318326.post-45050032667317866142018-02-12T23:58:18.588-08:002018-02-12T23:58:18.588-08:00Thank you this helped meThank you this helped meRaphaelhttps://www.blogger.com/profile/16659164416654480524noreply@blogger.comtag:blogger.com,1999:blog-279772059074318326.post-52335457908213699722017-07-15T10:04:47.806-07:002017-07-15T10:04:47.806-07:00I know that I can add a title tag to the circle by...I know that I can add a title tag to the circle by inserting<br />.append("svg:title").text(function(d) {<br /> return (d.title_text);<br /> })<br />But only some of my data points have an element d.title_text.<br />How do I write it so that only those circles get a title tag? With the code above hey all get one, it is just empty if no text is provided,Webmaster Astrodiensthttps://www.blogger.com/profile/04635582131086982785noreply@blogger.comtag:blogger.com,1999:blog-279772059074318326.post-16386665550301782112014-11-06T08:12:16.207-08:002014-11-06T08:12:16.207-08:00Yeah, there are quite a few shorthand techniques i...Yeah, there are quite a few shorthand techniques in JavaScript. There's a good page here (http://www.sitepoint.com/shorthand-javascript-techniques/) that has some great examples.<br />For the code above I really wanted to leave it long hand since it's aimed at people with less experience (like me :-)). Sometimes the shorthand versions can be a bit difficult to read.D3noobhttps://www.blogger.com/profile/03091573479428198379noreply@blogger.comtag:blogger.com,1999:blog-279772059074318326.post-30681716040864535032014-10-13T08:36:09.089-07:002014-10-13T08:36:09.089-07:00Is there a shorthand existing like if d.close == u...Is there a shorthand existing like if d.close == undefined return d.close else return 1 ?stefanhttps://www.blogger.com/profile/05872473212593308891noreply@blogger.com