@rollin
In d3.js, you can remove extra spaces between two ticks in a D3 axis by adjusting the tick padding.
Here's how you can do it:
Here's an example code snippet showing how to set the tick padding:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Define the x-axis
var xScale = d3.scaleLinear()
.domain([0, 100])
.range([0, width]);
var xAxis = d3.axisBottom(xScale)
.tickPadding(5);
// Append the axis to the SVG
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
|
By adjusting the tickPadding value, you can control the spacing between ticks on your D3 axis.