I'm reasonably confident that if
@Xon rendered each category out as as span with some additional attributes in the span, for example value:350, then use of flex and calc should take care of how it appeared in browser. Thinking both
@Brad Padgett 's and
@Mr Lucky 's rendering requirements could be taken care of this way... Well, 85% sure at this stage - without further experimentation.
User could simply then add CSS and bar would be custom rendered - 1 cat, 2 cats etc, without having to change server code other than the change to accommodate the above.