I am new to D3 and I’m currently using Observable Plot to visualize data on a Next.js Web App. The app pulls data that is hosted on a Heroku PostgresSQL database and will display it on the website.
Here is the code I am using to render a simple Bar chart, I am using the Plot examples provided by Observable for reference.
var element = document.getElementById('chart')
element?.append(
Plot.plot({
y: {
grid: true
},
marks: [
Plot.barY(data, {x: 'letter', y: 'frequency'}),
Plot.ruleY[0]
]
})
)
Somewhere in the body of my code I have:
<div id='chart'></div>
However the axis labels on my chart are being cutoff when the SVG renders:
How can I correct the label positions so they are not cutoff or overlapped?