We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Resize chart legend automatically

I have smart tags in one tab which is my data source for my pie chart. Is there a way to dynamically resize the legend of the chart based on the number of items being displayed?

example: I have a pie chart that shows sales per state ( see attachments)
When I have sales in 6 states the states in the legend look fine but when I only have 3 states there is excess spacing between each state in the legend.
Can the legend resize automatically or remove the excess spacing between each state in legend when there are fewer states to show?



thanks

Hi,


I think may try to use the line of code (Aspose.Cells API) for your requirements:

chart.Legend.IsAutomaticSize = true;

Thank you.