Highcharts甜甜圈馅饼/传说的位置

时间:2014-06-02 12:43:00

标签: javascript jquery highcharts

因此,我很难弄清楚如何设置饼图/图例位置的布局。我希望图例与左边对齐,而饼图与右边对齐。 40/60百分比-ish。

像这样:

enter image description here

chart = new Highcharts.Chart({
        chart: {
            renderTo: 'chart',
            type: 'pie',
        },
        credits: {
            enabled: false
        },
        title: {
            text : '',
        },
        plotOptions: {
            pie: {
                shadow: false,
                borderWidth: 0
            }
        },
        tooltip: {
            enabled: false
        },
        series: [{
            data: [
                {
                    name: "first",
                    y: 23
                },
                {
                    name: "second",
                    y: 8
                },
                {
                    name: "third",
                    y: 11
                },
                {
                    name: "fourth",
                    y: 11
                },
                {
                    name: "fifth",
                    y: 47

                }
            ],
            size: '100%',
            innerSize: '67%',
            showInLegend: true,
            dataLabels: {
                enabled: false
            }
        }]
    })

1 个答案:

答案 0 :(得分:11)

API所述,如何将legend添加到图表选项中呢?

legend: {
    align: 'left',
    layout: 'vertical',
    verticalAlign: 'top',
    x: 40,
    y: 0
}

呈现:

enter image description here

其余的你可以使用CSS样式