Issue at Hand:
I am working with a specific scale
var y = d3.scalePoint().domain(['a','b','c']).range([0,100]);
I have successfully created an axis for this scale
var y_axis = svg.append("g").attr("class", "axis").call(d3.axisLeft(y));
My current focus is on how to turn the ticks into clickable links
Challenges Faced:
The initial process seems uncomplicated
d3.selectAll('.tick').on('click', (d) => open_link_related_to(d))
However, my goal of allowing the links to remain functional even after downloading an SVG version of the plot introduces complexity. The approach would require something like:
d3.selectAll('.tick').insert("a").attr("xlink:href", (d) => text_link_related_to(d))
Nevertheless, the use of insert
does not neatly wrap the tick within the <a>
element -- it inserts below instead. Is there a way to achieve this wrapping with tickformat
or alternative techniques?