TheWaterstone
TheWaterstone

Reputation: 1

Pie of pie charts in Highcharts

I'm trying to create a pie of pie charts like they show in excel. I could not find a pie of pie support in highcharts. I can create two pie charts but I can't seem to connect them with lines as shown in the image below. Is there a workaround for this?

Pie of pie charts

Upvotes: 0

Views: 1268

Answers (1)

koorosh safeashrafi
koorosh safeashrafi

Reputation: 309

you must use drilldown. if you click on slice than chart switch to inner data.

ex:

Highcharts.chart('container', {
    chart: {
        type: 'pie',
    },
 
    series: [{
        name: 'out',
        data: [{
            name: 'data 1',
            y: 55,
            drilldown: 'data 1'
        },{
            name: 'data 2',
            y: 45,
            drilldown: 'data 2'
        }]
    }],
    
    drilldown: {
        series: [{
            name: 'inner 1',
            id: 'data 1',
            data: [
                ['inner 1-1', 24.13],
                ['inner 1-2', 17.2],
                ['inner 1-3', 8.11],
                ['inner 1-4', 5.33],
                ['inner 1-5', 1.06],
                ['inner 1-6', 0.5]
            ]
        }, {
            name: 'inner 2',
            id: 'data 2',
            data: [
                ['inner 2-1', 5],
                ['inner 2-2', 4.32],
                ['inner 2-3', 3.68],
                ['inner 2-4', 2.96],
                ['inner 2-5', 2.53],
                ['inner 2-6', 1.45],
                ['inner 2-7', 1.24],
                ['inner 2-8', 0.85]
            ]
        }]
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<div id="container" style="height: 400px"></div>

Upvotes: 2

Related Questions