YouTip LogoYouTip

Highcharts Pie Drilldown

[![Image 1: Highcharts Pie Chart](#)Highcharts Pie Chart](#) The following example demonstrates a drilldown pie chart. We have already learned the basic configuration syntax of Highcharts in previous chapters. Next, let's look at other configurations. * * * ## Configuration ### drilldown Configuration drilldown is used for drilling down into data, allowing you to click on an item to delve into its specific details. drilldown: { series: drilldownSeries } ### Example Filename: highcharts_pie_drilldown.htm
$(document).ready(function() { Highcharts.data({ csv: document.getElementById('tsv').innerHTML, itemDelimiter: 't', parsed: function (columns) { var brands = {}, brandsData = [], versions = {}, drilldownSeries = []; // Parse percentage strings columns = $.map(columns, function (value) { if (value.indexOf('%') === value.length - 1) { value = parseFloat(value); } return value; }); $.each(columns, function (i, name) { var brand, version; if (i > 0) { // Remove special edition notes name = name.split(' -'); // Split into brand and version version = name.match(/(+[.0-9x]*)/); if (version) { version = version; } brand = name.replace(version, ''); // Create the main data if (!brands) { brands = columns; } else { brands += columns; } // Create the version data if (version !== null) { if (!versions) { versions = []; } versions.push(['v' + version, columns]); } } }); $.each(brands, function (name, y) { brandsData.push({ name: name, y: y, drilldown: versions ? name : null }); }); $.each(versions, function (key, value) { drilldownSeries.push({ name: key, id: key, data: value }); }); var chart = { type: 'pie' }; var title = { text: 'Browser market shares. November, 2013' }; var subtitle = { text: 'Click the slices to view versions. Source: netmarketshare.com.' }; var xAxis = { type: 'category' }; var yAxis ={ title: { text: 'Total percent market share' } }; var tooltip = { headerFormat: '{series.name}
', pointFormat: '{point.name}: {point.y:.2f}% of total
' }; var credits = { enabled: false }; var series= [{ name: 'Brands', colorByPoint: true, data: brandsData }]; var drilldown= { series: drilldownSeries } var json = {}; json.chart = chart; json.title = title; json.subtitle = subtitle; json.xAxis = xAxis; json.yAxis = yAxis; json.tooltip = tooltip; json.credits = credits; json.series = series; json.drilldown = drilldown; $('#container').highcharts(json); } });});
← Highcharts 3D DonutHighcharts 3D Stacking β†’