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: https://codepen.io/suribabu_95/pen/ZXejXV?editors=0010

Thanks,

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.