d3 retrieve and add to current selection's attribute value
d3.js
Solution
D3 provides the `transform()` function for exactly this purpose:
var t = d3.transform(d3.select('.x.axis').attr("transform")),
x = t.translate[0],
y = t.translate[1];
Problem
I'm trying to get the values for an element's translation. For example, if I select the x axis: `d3.select('.x.axis').attr("transform")` then I get `"translate(0,112)"` How do I get the `0` and the `112` without parsing a regexp? I'm trying to do it so that I can add to the value. In pseudocode: ``` d3.selectAll('.x.axis').attr('transform', 'translate(' .attr('transform').match(/(\d+)(\.\d+)?/g)[0] // <-- clearly won't work + additional_value + ', 0)'); ```