简体   繁体   中英

How do you reduce the space between pie chart and legend? (highcharts.js)

Please see below example that comes from highchart official documents. There is still some space between legend and chart. I want to make the chart as large as possible, but not overlap the legend.

The data of my chart is dynamic. The number of legend items is variable. Therefore I cannot use a fixed marginBottom/ marginTop, eg

chart: {
   marginBottom: 50, // does not work for me, as the number of legend items is varied.
   marginTop: -10
}

http://jsfiddle.net/8z6mqd6d/

在此处输入图片说明

You can remove the padding and margin on the legend to get back some space.

        legend : {
            margin: 0,
          padding: 0
        },

Depending on how close you want to get it, you can make margin a negative number if you need to.

http://jsfiddle.net/8z6mqd6d/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM