# Setting max width of bar

**URL:** <https://community.plotly.com/t/setting-max-width-of-bar/25459>\
**Category:** plotly.js\
**Created:** [July 4, 2019, 4:20pm UTC](https://community.plotly.com/t/setting-max-width-of-bar/25459 "2019-07-04T16:20:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrayFox](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@GrayFox](https://community.plotly.com/u/GrayFox)\
**Post date:** [July 4, 2019, 4:21pm UTC](https://community.plotly.com/t/setting-max-width-of-bar/25459/1 "2019-07-04T16:21:00Z")

</div>

Hi. I’m trying to force a max bar width for a responsive barchart.

To do so i’m using the event afterPlot to figure out the ratio that I need to set in the data[trace position].width (using the width of the div where the plot is and the max width that I want in px).

To force a re-render I update the revision and everything works fine but I have the following error:  
Uncaught (in promise) TypeError: Cannot read property ‘\_rehover’ of undefined  
at plots.rehover (plotly-basic.js:63058)  
at Object.lib.syncOrAsync (plotly-basic.js:36865)  
at continueAsync (plotly-basic.js:36860)

I think maybe I’m messing up the lifecycle of plotly or something like that…

Many thanks.
