I would like to render HTML on the x-axis of my D3 graph. Basically, I want each label on the axis to be a hyperlink to another column from the data.
I've tried
x.domain(data.map(function(d) { return "<a href=\"" + d.SiteUrl + "\">" + d.Name + "</a>"; }));
but it's not working, at all. Instead of getting a hyperlink I get the actual text value:
<a href="http://example.com">Something</a>
I've also tried adding
.tickFormat(function(d) { return "<a href=\"" + d.SiteUrl + "\">" + d.Name + "</a>"; })
on the x-axis, as well as altering the .attr("x", ...)
to
.attr("x", function(d) { return "<a href=\"" + d.SiteUrl + "\">" + x(d.Name) + "</a>"; })
on the chart itself.
Am I missing something?