I’m working on the Bar Chart project for the Data viz certification, and I’m running into some trouble getting the xAxis labels to appear. Relevant code is as follows:
const xAxisGenerator = d3.axisBottom().scale(xScale).ticks(14);
const xAxis = bounds
.append('g')
.call(xAxisGenerator)
.attr('id', 'x-axis')
.style('transform', `translateY(${dimensions.boundedHeight}px)`);
const xAxisLabel = xAxis
.append('text')
.attr('x', dimensions.boundedWidth / 2)
.attr('y', dimensions.margin.bottom - 10)
.attr('fill', 'black')
.style('font-size', '1.4em');
I’m using the same approach for the scatterplot chart, and it’s working just fine there, so I’m not sure what the problem is. Full code is at: https://github.com/dylanesque/BarChart