maxWidth: Number

Sets the maximum width of legend. If any item is longer than the maxWidth, it gets wrapped or clipped depending on the itemWrap property. itemWrap is true by default. Whenever items are stacked horizontally, new items are moved to the next row once maxWidth is reached.


Default: Automatically calculated based on the chart size.
Example: 100, 200, 500 etc.

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
legend:{
  maxWidth: 200,
 },

 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.

  Also See:    



If you have any questions, please feel free to ask in our forums.Ask Question

Comment

  1. Is there a way that you could put width as a percentage (chart width 100% of page, and legend is 25% of the chart size)?