The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

529486 (7) [Avatar] Offline

Could someone explain the use of $ in this line:

const g = svg.append('g')
.attr('transform', `translate(${margin.left}, ${})`);

found here:


stevegw (39) [Avatar] Offline
The $ is a jquery selector

$(selector).action() A $ sign to define/access jQuery. A (selector) to "query (or find)" HTML elements. A jQuery action() to be performed on the element(s)
529486 (7) [Avatar] Offline
Thanks. I assume that means the non-jQuery way of accessing margin.left and would be more complicated...
stevegw (39) [Avatar] Offline
529486 (7) [Avatar] Offline
Awesome, thanks!
529486 (7) [Avatar] Offline
Actually, to answer my own question, since the reference in my example is to the variable margin, not the value of the svg.marginTop, the equivalent non-jQuery alternative would be:

const g = svg.append('g')
.attr('transform', 'translate(' + margin.left + ',' + + ')');