如何使用HighCharts减少极坐标图上方的边距?

时间:2016-09-17 04:21:46

标签: highcharts

在这种情况下,图像显示。利润率太大。反正是为了让它更小甚至为零?

http://jsfiddle.net/7rLnwdxu/1/

the margin is too large

代码:

$(function () {

$('#container').highcharts({

    chart: {
        polar: true,
        type: 'line'
    },

    title: {
        text: 'Budget vs spending',
        x: -80
    },

    pane: {
        size: '80%'
    },

    xAxis: {
        categories: ['Word1_Word2', 'Word1 Word2', 
        'Word1 - Word2', 'Word1-Word2', 
        'Word1 Word2', 'Word1 Word2'],
        tickmarkPlacement: 'on',
        lineWidth: 0
    },

    yAxis: {
        gridLineInterpolation: 'polygon',
        lineWidth: 0,
        min: 0
    },

    tooltip: {
        shared: true,
        pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>'
    },

    legend: {
        align: 'right',
        verticalAlign: 'top',
        y: 70,
        layout: 'vertical'
    },

    series: [{
        name: 'Allocated Budget',
        data: [43000, 19000, 60000, 35000, 17000, 10000],
        pointPlacement: 'on'
    }, {
        name: 'Actual Spending',
        data: [50000, 39000, 42000, 31000, 26000, 14000],
        pointPlacement: 'on'
    }]

});
});

1 个答案:

答案 0 :(得分:1)

您可以使用图表选项中的'marginTop'属性执行此操作,例如:

chart: {
    marginTop: 10,
    polar: true,
    type: 'line'
}

此值以像素为单位。