在图表按钮上设置一个Iine中的Highcharts蜘蛛网图例的问题

时间:2014-07-15 14:57:15

标签: highcharts

请你看一下this demo,让我知道如何启用高级图表将图例项目放在图表的一行和一行中?

$(function () {

    $('#container').highcharts({

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

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

        pane: {
            size: '80%'
        },

        xAxis: {
            categories: ['Sales', 'Marketing', 'Development', 'Customer Support', 
                    'Information Technology', 'Administration'],
            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 :(得分:2)

你会想要这个:

legend: {
            align: 'center',
            verticalAlign: 'bottom',
            layout: 'horizontal'
        }

演示:http://jsfiddle.net/robschmuecker/pxS6X/