var legendsectorAirline = {}; var legendsectorAlliance = {}; legendsectorAlliance['OneWorld'] = 0; legendsectorAlliance['Star Alliance'] = 0; legendsectorAlliance['SkyTeam'] = 0; legendsectorAlliance['No Alliance'] = 218; legendsectorAirline['Garuda Indonesia'] = 15; legendsectorAirline['Lion Air'] = 68; legendsectorAirline['Citilink'] = 30; legendsectorAirline['Indonesia AirAsia'] = 53; legendsectorAirline['Batik Air'] = 26; legendsectorAirline['Scoot'] = 2; legendsectorAirline['Sriwijaya Air'] = 3; legendsectorAirline['Tigerair Mandala'] = 7; legendsectorAirline['AIRPORT-OPERATED'] = 4; legendsectorAirline['Air Asia'] = 2; legendsectorAirline['Air Asia X'] = 2; legendsectorAirline['Super Air Jet'] = 5; legendsectorAirline['Pelita Air'] = 1; legendsectorAirline['OneWorld'] = 0; legendsectorAirline['Star Alliance'] = 0; legendsectorAirline['SkyTeam'] = 0; legendsectorAirline['No Alliance'] = 218; $(function () { var chart; $(document).ready(function() { var colors = Highcharts.getOptions().colors, categories = ['No Alliance'], name = 'Carriers', data = [{ y: 100, color: colors[3], drilldown: { name: 'No Alliance (218)', categories: ['Garuda Indonesia','Lion Air','Citilink','Indonesia AirAsia','Batik Air','Sriwijaya Air','Tigerair Mandala','AIRPORT-OPERATED','Super Air Jet','Others'], data: [6.9,31.2,13.8,24.3,11.9,1.4,3.2,1.8,2.3,3.2], color: colors[3] } } ]; // Build the data arrays var allianceData = []; var carrierData = []; for (var i = 0; i < data.length; i++) { // add browser data allianceData.push({ name: categories[i], y: data[i].y, color: data[i].color }); // add version data for (var j = 0; j < data[i].drilldown.data.length; j++) { var brightness = 0.2 - (j / data[i].drilldown.data.length) / 5 ; carrierData.push({ name: data[i].drilldown.categories[j], y: data[i].drilldown.data[j], color: Highcharts.Color(data[i].color).brighten(brightness).get() }); } } // Create the chart chart = new Highcharts.Chart({ chart: { renderTo: 'airline_sector', type: 'pie' }, title: { text: '' }, yAxis: { title: { text: '' } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true }, showInLegend: false } }, tooltip: { valueSuffix: '%' }, series: [{ name: 'proportion', data: allianceData, size: '80%', dataLabels: { formatter: function() { return this.y > 5 ? this.point.name : null; }, color: 'white', distance: -75 } }, { name: 'proportion', data: carrierData, innerSize: '80%', dataLabels: { formatter: function() { // display only if larger than 1 return this.y > 1 ? ''+ this.point.name +': '+ this.y + '%' + getCountsector(this.point.name) : null; } } }] }); }); }); function getCountsector(airline) { if(legendsectorAirline[airline]) { return " (" + parseInt(legendsectorAirline[airline]).toLocaleString() + ")"; } else { return ""; } }