layout = {
const width = 1000;
const height = 40;
const svg = d3.create("svg")
.attr('width', width)
.attr('height', height)
.attr("viewBox", [0, 0, width, height])
const xScale = d3.scaleLinear()
.domain([1, n * 1.1])
.range([0, width]);
function getTicks(max, count = 10) {
let ticks = d3.ticks(1, max, count - 1);
return [1, ...ticks];
}
const xAxis = d3.axisBottom(xScale)
.tickValues(getTicks(n*1.1, 10))
.tickSize(2)
.tickFormat(d3.format('d'));
svg.append('g')
.attr('transform', `translate(0, ${height / 2})`)
.call(xAxis);
svg.selectAll('.tick text')
.attr('dy', 10);
return svg.node();
}