Highcharts甜甜圈没有内部饼图?(Highcharts donut chart withou

2019-06-26 13:34发布

我一直在寻找解决方案,以生成Highcharts库最简单的圆环图。 然而,Highcharts的所有实施例显示图表的与两个内馅饼和油炸圈饼外(参考:样式http://www.highcharts.com/demo/pie-donut )

我怎样才能摆脱内馅饼,只是保持外甜甜圈,就像其他图书馆吗? (类似RGraph: http://www.rgraph.net/examples/donut.html )

谢谢。

Answer 1:

你只需要提供该数据作为两个元件(键/值)数组的数组。 指定一个innerSize获得甜甜圈风格。

所以,你的参数将包含这样的事情:

...
data: [["Firefox",6],["MSIE",4],["Chrome",7]],
innerSize: '20%',
...

这里有一个完整的例子的jsfiddle 。



Answer 2:

**I hope this example of highchat will solve your problum

http://jsfiddle.net/e2qpa/3/

$(function() {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            type: 'pie'
        },

        plotOptions: {
            pie: {
                borderColor: '#000000',
                innerSize: '60%'
            }
        },
        series: [{
            data: [
                ['Firefox', 44.2],
                ['IE7', 26.6],
                ['IE6', 20],
                ['Chrome', 3.1],
                ['Other', 5.4]
                ]}]
    },
    // using

    function(chart) { // on complete

        var xpos = '50%';
        var ypos = '53%';
        var circleradius = 102;

    // Render the circle
    chart.renderer.circle(xpos, ypos, circleradius).attr({
        fill: '#ddd',
    }).add();

    // Render the text
    chart.renderer.text('THIS TEXT <span style="color: red">should be in the center of the donut</span>', 155, 215).css({
            width: circleradius*2,
            color: '#4572A7',
            fontSize: '16px',
            textAlign: 'center'
      }).attr({
            // why doesn't zIndex get the text in front of the chart?
            zIndex: 999
        }).add();
    });
});


Answer 3:

这是顶级的搜索结果,并给予我没有工作的答案。 我需要在比阵列的只是一个简单的阵列中的数据点的更多控制。 我需要使用JSON对象来配置诸如明确的颜色特定数据的附加选项。 我通过一些研究,你不必在所有修改的数据格式中。 所有你必须为了使一个饼图成圆环图做的是刚刚设置的数据系列innerSize值大于0。

从highcharts文档:

innerSize:内径为馅饼的尺寸。 甲大小大于0呈现圆环图。 可以是百分比或像素值。 百分比是相对于馅饼的大小。 像素值以整数。

所以,你可以得到与像以下数据的简单圆环图:

        series: [{
            innerSize: '30%',
            data: [
                {name: 'Yellow Slice', y: 12, color: 'yellow'},
                {name: 'Red Slice', y: 10, color: 'red' },
                {name: 'Blue Slice', y: 33, color: 'blue'},
                {name: 'Green Slice', y: 20, color: 'green'}
            ]
        }]

JS小提琴



文章来源: Highcharts donut chart without inner pie?