6

I've searched through all similar questions but I couldn't find a solution.

The Pie chart I've developed looks like below picture and I want to remove that empty space and force the chart to strech itself inside its container.

enter image description here

The config:

{
  grid: {
    left: 0,
    top: 0,
    right: 0,
    bottom: 0
  },
  radius: '100%',
}

CSS applied to:

width: 100%; // It doesn't matter I apply pixel width or percentage, empty space remains
height: 420px;
Pooria Han
  • 597
  • 1
  • 4
  • 19

2 Answers2

2

The only solution that I've found is this:

chartOption = {
  series: [
    {
      type: 'pie',
      top: '-20%',
      left: '-20%',
      right: '-20%',
      bottom: '-20%',
    }
  ]
}

After this you have to add specific css width and height to the DIV that contain the chart (width: 300px, height 300px for example). This will reduce the whitespaces of the container of the chart and leave just a security space for the emphasis when you will hover the chart. If you set the top, left, right and bottom keys with fixed values, you will have to make a precision adjustment in relation of the width and height that you set in the css. Not good! I've tried! The best way is to use the -20% value like I've sayed up.

Let me know if it works!

adi_hazard
  • 36
  • 3
1

Increase radius to reduce padding.

{
 name: "",
 type: "pie",
 color: colorPalette,
 radius: "90%", // Increase this percentage to reduce padding
}
Mert
  • 474
  • 2
  • 8
  • 21