var legendsectorAirline = {}; var legendsectorAlliance = {}; legendsectorAlliance['OneWorld'] = 55; legendsectorAlliance['Star Alliance'] = 263; legendsectorAlliance['SkyTeam'] = 24; legendsectorAlliance['No Alliance'] = 222; legendsectorAirline['Scoot'] = 55; legendsectorAirline['Singapore Airlines'] = 211; legendsectorAirline['Air Asia'] = 23; legendsectorAirline['JetStarAsia'] = 29; legendsectorAirline['KLM Royal Dutch Airlines'] = 7; legendsectorAirline['Starlux Airlines'] = 1; legendsectorAirline['Batik Air Malaysia'] = 10; legendsectorAirline['Vietnam Airlines'] = 10; legendsectorAirline['Malaysia Airlines'] = 17; legendsectorAirline['Silkair'] = 25; legendsectorAirline['Firefly'] = 11; legendsectorAirline['Thai'] = 21; legendsectorAirline['British Airways'] = 2; legendsectorAirline['TAP Portugal'] = 1; legendsectorAirline['Vueling'] = 3; legendsectorAirline['Ryanair'] = 2; legendsectorAirline['Aer Lingus'] = 1; legendsectorAirline['Cathay Pacific'] = 11; legendsectorAirline['Lion Air'] = 1; legendsectorAirline['Qantas'] = 12; legendsectorAirline['Swiss'] = 5; legendsectorAirline['Nok Air'] = 1; legendsectorAirline['Thai Air Asia'] = 9; legendsectorAirline['Air Berlin'] = 1; legendsectorAirline['JetBlue'] = 5; legendsectorAirline['EasyJet'] = 2; legendsectorAirline['EVA'] = 2; legendsectorAirline['Cebu Pacific'] = 1; legendsectorAirline['Air Philippines'] = 1; legendsectorAirline['TransAsia Airways'] = 1; legendsectorAirline['Tsaradia'] = 7; legendsectorAirline['Jetstar Airways'] = 2; legendsectorAirline['Myanmar Airways International'] = 2; legendsectorAirline['Virgin Atlantic'] = 1; legendsectorAirline['Virgin America'] = 1; legendsectorAirline['Druk Air'] = 3; legendsectorAirline['Cathay Dragon'] = 1; legendsectorAirline['Indonesia AirAsia'] = 4; legendsectorAirline['Turkish Airlines'] = 7; legendsectorAirline['Pegasus Airlines'] = 1; legendsectorAirline['Qatar Airways'] = 6; legendsectorAirline['Garuda Indonesia'] = 2; legendsectorAirline['Brussels Airlines'] = 1; legendsectorAirline['Czech Airlines'] = 1; legendsectorAirline['Thai Lion Air'] = 2; legendsectorAirline['Vanilla Air'] = 1; legendsectorAirline['All Nippon Airways'] = 2; legendsectorAirline['China Airlines'] = 4; legendsectorAirline['Japan Airlines'] = 3; legendsectorAirline['Myanmar National Airlines'] = 2; legendsectorAirline['Thai AirAsiaX'] = 2; legendsectorAirline['Air New Zealand'] = 7; legendsectorAirline['JetStar Japan'] = 1; legendsectorAirline['IcelandAir'] = 2; legendsectorAirline['SAS'] = 1; legendsectorAirline['Alaska Airlines'] = 1; legendsectorAirline['Bamboo Airways'] = 2; legendsectorAirline['VietJet Air'] = 4; legendsectorAirline['Iberia'] = 1; legendsectorAirline['Ryanair UK'] = 2; legendsectorAirline['Asiana Airlines'] = 1; legendsectorAirline['Lufthansa'] = 2; legendsectorAirline['Emirates'] = 1; legendsectorAirline['Delta'] = 1; legendsectorAirline['United Airlines'] = 2; legendsectorAirline['OneWorld'] = 55; legendsectorAirline['Star Alliance'] = 263; legendsectorAirline['SkyTeam'] = 24; legendsectorAirline['No Alliance'] = 222; $(function () { var chart; $(document).ready(function() { var colors = Highcharts.getOptions().colors, categories = ['OneWorld','Star Alliance','SkyTeam','No Alliance'], name = 'Carriers', data = [{ y: 9.8, color: colors[0], drilldown: { name: 'OneWorld (55)', categories: ['Malaysia Airlines','Cathay Pacific','Qantas','Qatar Airways','Others'], data: [3,2,2.1,1.1,1.7], color: colors[0] } } ,{ y: 46.6, color: colors[1], drilldown: { name: 'Star Alliance (263)', categories: ['Singapore Airlines','Thai','Turkish Airlines','Air New Zealand','Others'], data: [37.4,3.7,1.2,1.2,3.3], color: colors[1] } } ,{ y: 4.3, color: colors[2], drilldown: { name: 'SkyTeam (24)', categories: ['KLM Royal Dutch Airlines','Vietnam Airlines','Others'], data: [1.2,1.8,1.3], color: colors[2] } } ,{ y: 39.4, color: colors[3], drilldown: { name: 'No Alliance (222)', categories: ['Scoot','Air Asia','JetStarAsia','Batik Air Malaysia','Silkair','Firefly','Thai Air Asia','Tsaradia','Others'], data: [9.8,4.1,5.1,1.8,4.4,2,1.6,1.2,10.1], 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 ""; } }