1

Is there a way to remove the padding between the container and the graph in AmCharts4?

I have tried chart.padding(0, 0, 0, 0) but it doesn't have an effect.

https://codepen.io/ChazUK/pen/JjKVvNv

const chart = am4core.create('chart', am4charts.GaugeChart);
chart.innerRadius = am4core.percent(80);
chart.logo.disabled = true;
chart.responsive.enabled = true;

... rest in codepen

Remove Padding

ChazUK
  • 744
  • 4
  • 26

1 Answers1

1

You need to increase the outer radius of the gauge, and also set padding to 0 on all edges of the chart itself:

chart.radius = am4core.percent(100);
chart.innerRadius = am4core.percent(80);
chart.paddingTop = 0;
chart.paddingRight = 0;
chart.paddingBottom = 0;
chart.paddingLeft = 0;
BadHorsie
  • 14,135
  • 30
  • 117
  • 191
  • Thanks, It's not very obvious that you have to change the outer radius in the docs. I have also noticed that <400px the container adds padding back `` – ChazUK Nov 18 '20 at 14:42
  • Fixed with https://gist.github.com/ChazUK/9e35b0c38982f4adf1fe1c94831473fb – ChazUK Nov 18 '20 at 14:51