I am working with a d3 matrix that has both an x and y-axis. However, my y-axis is quite long, so I want to ensure that the x-axis remains visible even when scrolling. I have tried setting the position attribute to 'fixed' using .style("position", "fixed"), but it doesn't seem to solve the issue. In simpler terms, I am looking to replicate the functionality in Excel where a row/column can be frozen.
Here is the code snippet I currently have:
var columnLabels = svg.append("g")
.selectAll(".columnLabelg")
.data(columnLabel)
.enter()
.append("text")
.text(function(d) { return d; })
.attr("x", function(d, i) { return i * cellSize; })
.attr("y", -1)
.style("text-anchor", "right")
.attr("transform", function(d, i) {
return "translate(" + i + ",-6)"
+ "rotate(300 "+ i * cellSize + " " + (-6) +")"; })
.attr("class", function (d,i) { return "columnLabel mono c"+i;} )
.on("mouseover", function(d) {d3.select(this).classed("text-hover",true);})
.on("mouseout" , function(d) {d3.select(this).classed("text-hover",false);})
;