How to fix area for legends?

Is it possible to assign an area in which all the legends will be displayed?
In my case, I have a dashboard in which there are multiple cards, each consisting of a plotly graph(bar/scatter/pie/bargroup). The size of each card is fixed as of now. Let’s say, in case of bar graph, if my trace contains 5 values of (x,y), it works perfectly fine. But in case where trace contains say, 10 values of (x,y), so here, the legend area overlaps on the plot area. I need to fix the legend area, so that if there are more than 5 legends they should be displayed either with a scrollbar of there should be one legend with label (…), hovering on or clicking on which the user can see the rest of the legends. Or is there any other way to achieve the same?