Highcharts pie chart dynamically changes size

16,725

You will have to set a fixed size for the pie chart. Can be a percentage or a pixel value. For example:

plotOptions: {
        pie: {
            size: 100
        }
    },

See this fiddle from the API http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/pie-size/

Share:
16,725
Water Monkey
Author by

Water Monkey

Updated on July 29, 2022

Comments

  • Water Monkey
    Water Monkey almost 2 years

    I am having an issue with a pie chart I created in highcharts.

    Depending on the placement of the data labels the actual chart will grow or shrink.

    We need the pie chart to stay the same size so is there a way to keep the pie size constant and force the labels to fit around it or do I just have to place the labels inside each slice?

  • Water Monkey
    Water Monkey about 10 years
    Thanks, this worked. I set the size to '80%' and the pie stayed a consistent size. The issue you run into when you set size to a fixed value is you run the risk of the data labels being pushed out of view. I'll play with the percentage size. I'll play with the percent and the size of the DIV to see if I can add a little more room for the data labels
  • Water Monkey
    Water Monkey about 10 years
    Here is a fiddle example using size with the datalabel now being chopped off: jsfiddle.net/4GFyj
  • Sualkcin
    Sualkcin about 10 years
    May not be the solution you want but you can set the 'distance' property of the 'dataLabels' to a smaller number or even negative to place it inside the pie slices. Maybe change the 'color' to white if you do that. jsfiddle.net/4GFyj/2
  • Max xaM
    Max xaM over 7 years
    @Sualkcin +1 and thanks but you've omitted the '#' from your fiddle Hex color.