As I try to access the d
attribute of a path that was generated using Javascript
, the output of printing the path element appears as follows:
path class="coastline"
d="M641.2565741281438,207.45837080935186L640.7046722156485,207.0278378856494L640.6985715873882,207.1279196729914L640.8663103175278,207.53837609537672L640.8542041922302,207.73856415298116L641.04637606029"
... with a more extensive path. I have managed to retrieve the class attribute by utilizing the getAttribute
method associated with class
. Yet, my attempts to obtain the d
attribute result in receiving null
. Could there be something else required for me to do?
edit: This is how I am currently trying to acquire the d attribute (my main focus being on the coastline):
var path = d3.geo.path().projection(globe.projection).pointRadius(7);
var coastline = d3.select(".coastline");
console.log(coastline[0][0]);
console.log(coastline[0][0].getAttribute('class'));
console.log(coastline[0][0].getAttribute('d'));