最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to remove (left) padding from ApexChart? - Stack Overflow

programmeradmin4浏览0评论

I use ApexCharts to render a simple line chart. Now I would like to remove the padding around this chart. I do want the labels on both axes, but there should not be any more spacing between those lables and the border of the chart.

You can see what I mean here - I don't want the spacing left of "Fehler" on the Y-axis, nor the spacing below "Tage" on the X-axis:

I tried it with this option:

    grid: {
        padding: {
            top: 0,
            right: 0,
            bottom: 0,
            left: 0
        },  
    },

However, that did not solve this issue for me.
Also enabling sparkline: true in the chart section does not help.

Any other ideas?

I use ApexCharts to render a simple line chart. Now I would like to remove the padding around this chart. I do want the labels on both axes, but there should not be any more spacing between those lables and the border of the chart.

You can see what I mean here - I don't want the spacing left of "Fehler" on the Y-axis, nor the spacing below "Tage" on the X-axis:

I tried it with this option:

    grid: {
        padding: {
            top: 0,
            right: 0,
            bottom: 0,
            left: 0
        },  
    },

However, that did not solve this issue for me.
Also enabling sparkline: true in the chart section does not help.

Any other ideas?

Share Improve this question asked Jul 6, 2021 at 15:28 MatthiasMatthias 10.4k16 gold badges79 silver badges144 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

For Y axis you can add negative offsets and get rid of space in left side.

yaxis: {
          tickAmount: 3,
          labels: {
            offsetX: -15,
          },
        },

grid: {
          padding: {
            left: -5,
          },
        },

More ref - https://github./apexcharts/apexcharts.js/issues/178#issuement-617360081

发布评论

评论列表(0)

  1. 暂无评论