Reputation: 86
I have a problem of when I generate a pie chart by Amchars, and that graph has many slices the title of the slices are hidden by the height of the div that contains the graph.
I'm looking for a way to make this self-adjusting height.
Follow the image below with the problem:
Upvotes: 0
Views: 407
Reputation: 16012
Unfortunately your options are pretty limited as the pie chart tries to make a best effort in not having the labels overlap, which can cause the out of bounds rendering you're experiencing.
If you need to see all the labels, you'll want to adjust one of or a combination of the labelRadius
, startAngle
and pullOutRadius
properties to make more room for the chart and labels.
labelRadius
reduces distance of labels from the chart.
startAngle
determines where the pie chart will start drawing. Setting it to 0 will make the pie start and end on the left, where there is much more space for all the labels crammed in one space.
pullOutRadius
determines the distance of the slice pull out when you click on it. Setting it to a smaller value will make the chart bigger, larger will shrink it. This takes either a percentage string or numeric values.
Experimenting with a combination of these settings might get you to the desired result.
If you don't want or need to see all the labels, especially for very small slices such as in your screenshot, then consider setting the hideLabelsPercent
property to a percentage threshold that your values need to reach in order to have a label set. In your case, 1.15 might be enough to hide the remaining labels, but I can't tell without a fiddle with your data.
Upvotes: 1