Sorry I just saw this. Thanks John for answering.
With rCharts, we can take advantage of the afterScript template to add this. If there is only one chart in the DOM, we can use John's example unmodified.
d1$setTemplate(
afterScript =
'
d3.selectAll(".axis.title")
.text(function () {
var t = d3.select(this).text();
if (t === "disp") {
return "Displacement";
} else if (t === "mpg") {
return "Miles Per Gallon";
} else {
return t;
}
});
'
)
Please let me know if this you would like an example with multiple charts in the DOM or this does not work for you. Thanks.