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 wrap the legend text in plotly.js

I have created ploly chart by using js file and the legend text is truncating with more than 15 plots and the legend should be rendered in horizontal position.

I’m no good with js but have experienced a similar issue using the R api. I resolved it by adding and playing with the margin space so there is more room.

In js I believe that is done by adding a parameter like the one below

var layout = {
autosize: false,
width: 500,
height: 500,
margin: {
l: 50,
r: 50,
b: 1000,
t: 100,
pad: 4