以椭圆形高图重绘饼图

时间:2013-01-25 07:06:46

标签: jquery highcharts

是否可以将饼图(highcharts.com)重绘为椭圆形,如图enter image description here所示

还有右侧的影子。

我试过这段代码

// Radialize the colors
            Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
                return {
                    radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
                    stops: [
                        [0, color],
                        [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
                    ]
                };
            });

但显示的变化不大,这里是jsfiddle http://jsfiddle.net/jhAD8/

请看一下,

2 个答案:

答案 0 :(得分:1)

不支持3D图表,包括您在上面发布的更改视角。但你可以投票给它http://highcharts.uservoice.com

答案 1 :(得分:0)

更新:支持3D图表。要获得您正在寻找的图表,您可以在3D饼图中设置β角度旋转。演示:http://jsfiddle.net/41004emr/

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'pie',
            options3d: {
                enabled: true,
                alpha: 0,
                beta: 45
            }
        },
        title: {
            text: 'Browser market shares at a specific website, 2014'
        },
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                depth: 35,
                dataLabels: {
                    enabled: true,
                    format: '{point.name}'
                }
            }
        },
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [
                ['Firefox', 45.0],
                ['IE', 26.8],
                ['Chrome',12.8],
                ['Safari', 8.5],
                ['Opera', 6.2],
                ['Others', 0.7]
            ]
        }]
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="height: 400px"></div>