Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove amCharts container padding?

I'm trying to remove the padding / margin of amChart.

I've tried to use am4core.percent(100) for chart.width and chart.plotContainer.width.

I'm browsing the web for a bit, without success. I don't know if it's because of the amChart logo in bottom left creating that padding.

like image 923
Axel.L Avatar asked Mar 18 '26 19:03

Axel.L


1 Answers

For AmCharts 5 the correct way for setting padding to 0 is:

  const chart = root.container.children.push(am5xy.XYChart.new(root, {
    paddingRight: 0,
    paddingTop: 0,
    paddingBottom: 0,
    paddingLeft: 0,
  }));

Have a look at their doc: https://www.amcharts.com/docs/v5/reference/xychart/#paddingBottom_setting

Also knowing how a XY chart is structured in AmCharts 5 can be very handy: https://www.amcharts.com/docs/v5/charts/xy-chart/xy-chart-containers/

like image 80
Andrei T Avatar answered Mar 20 '26 09:03

Andrei T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!