Currently, I am developing a React Chart JS component that displays a set of horizontal bars. My objective is to maintain the width of the bars at a consistent size regardless of the number of bars present (e.g., all bars at 30px).
However, when additional bars are added to the component, the overall bar width adjusts accordingly, which is not my intended outcome.
I attempted to use the "barThickness" option, but when too many bars are added, they end up taking up all the available space and get hidden behind one another (as depicted in this image). As a result, the canvas size shrinks too much, causing negative spacing between the bars when I actually want to keep it positive.
import React from "react";
import {HorizontalBar} from 'react-chartjs-2';
import 'chartjs-plugin-error-bars'
import {withTheme,ThemeProps} from "styled-components";
import {
Theme
} from "@material-ui/core";
...
// The code continues as provided
...
One potential solution could be to adjust the canvas size dynamically based on the number of bars added, but I am unsure how to implement this feature.