My component generates HTML for a simple bar chart, with the height and background color computed within the component. Everything functions correctly, but I am facing an issue where long text causes displacement of the bar above it.
Another problem is that the width of the bars seems to depend on the width of the text, but that's a topic for another discussion.
When the viewport is wide enough, the chart looks like this:
https://i.sstatic.net/IolYb.png
However, when the viewport is smaller (this is the issue I want to address): https://i.sstatic.net/Xb73m.png
I believe there needs to be some offsetting for the rest of the bars and their labels?
<ul class="flex gap-3 items-end">
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:42.666666666666664px;background-color:#d73027" title="Apple - 10">
</span>
<div class="text-sm text-center">Apple</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:128px;background-color:#f46d43" title="Very Long Banana - 30">
</span>
<div class="text-sm text-center">Very Long Banana</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:64px;background-color:#fdae61" title="Orange - 15">
</span>
<div class="text-sm text-center">Orange</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:106.66666666666667px;background-color:#fee08b" title="Grape - 25">
</span>
<div class="text-sm text-center">Grape</div>
</li>
</ul>