Whenever I log the selection.attributes , it logs the values that are exactly required, for example if there's an attribute called y it would log the same value that the rect has in the DOM at the runtime, but whenever I try to access that value using selection.attributes.y.nodeValue it instead returns the original value of the rect that it was rendered with.
My question is that if the actual attributes object has the current values then why does it return t he different value when I try to access the key (in this case y.nodeValue) in that object?
For further explanation:
Here's my code for logging object and code for logging the retrieval of the value:
var notLiveYAttributes = chart.select("#not-live" + i + " rect.not-live")[0][0].attributes;
console.log(notLiveYAttributes);
console.log(notLiveYAttributes.y.value);
Output:
What am I missing here and how can I retrieve the current values of the attributes (y and height) instead of when it was originally rendered/populated?
Aucun commentaire:
Enregistrer un commentaire