Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Unable to trim axis labels using namelength

When axis labels are too long, they are getting out of chart space. I would like to trim long labels and add ellipsis(atleast trim them). I tried namelength attribute and its not working. Am I using it wrongly or is there any other attribute to do it?

Codepen Link:


namelength only has an effect on the name part of the hover labels (which does not appear by default on single-trace graphs like yours above).

I’d recommend setting fully custom hovertext to accomplish this task.