Without doing all the work, here's a start:
First off define your data 'out-of-line' rather than inline, then process the drilldown series first and make an associative array which we can use to populate the drilldown property of the series data.
This now formats the data into the same shape roughly as the other demo and you can start playing around with the listeners etc. Since your data doesn't always have a data from drilldown you would have to handle that somehow in anycase. Either by defining 0 data for drilldown and thus adding a drilldown property to every series data or checking on click and taking appropriate action.
Demo:http://jsfiddle.net/robschmuecker/e9uJ2/2/
deltonaData = [{
name: 'Total nonfarm',
y: 160300,
supp: 0,
priv: 0
}, {
name: 'Total private',
y: 140000,
supp: 0,
priv: 0
}, {
name: 'Goods-producing',
y: 17800,
supp: 0,
priv: 0
}, {
name: 'Service-providing',
y: 142500,
supp: 0,
priv: 0
}, {
name: 'Private service-providing',
y: 122200,
supp: 0,
priv: 0
}, {
name: 'Mining, Logging, and Construction',
y: 8500,
supp: 0,
priv: 0
}, {
name: 'Manufacturing',
y: 9300,
supp: 0,
priv: 0
}, {
name: 'Trade, transportation, and utilities',
drilldown: '400000001',
y: 30000,
supp: 0,
priv: 0
}, {
name: 'Information',
y: 1800,
supp: 0,
priv: 0
}, {
name: 'Financial activities',
y: 7700,
supp: 0,
priv: 0
}, {
name: 'Professional and business services',
y: 18400,
supp: 0,
priv: 0
}, {
name: 'Education and health services',
drilldown: '650000001',
y: 32600,
supp: 0,
priv: 0
}, {
name: 'Leisure and hospitality',
y: 24100,
supp: 0,
priv: 0
}, {
name: 'Other services',
y: 7600,
supp: 0,
priv: 0
}, {
name: 'Government',
drilldown: '900000001',
y: 20300,
supp: 0,
priv: 0
}];
capeData = [{
name: 'Total nonfarm',
y: 224200,
supp: 0,
priv: 0
}, {
name: 'Total private',
y: 185100,
supp: 0,
priv: 0
}, {
name: 'Goods-producing',
y: 22400,
supp: 0,
priv: 0
}, {
name: 'Service-providing',
y: 201800,
supp: 0,
priv: 0
}, {
name: 'Private service-providing',
y: 162700,
supp: 0,
priv: 0
}, {
name: 'Mining, Logging, and Construction',
y: 17400,
supp: 0,
priv: 0
}, {
name: 'Manufacturing',
y: 5000,
supp: 0,
priv: 0
}, {
name: 'Trade, transportation, and utilities',
drilldown: '400000000',
y: 47000,
supp: 0,
priv: 0
}, {
name: 'Information',
y: 3300,
supp: 0,
priv: 0
}, {
name: 'Financial activities',
y: 11700,
supp: 0,
priv: 0
}, {
name: 'Professional and business services',
y: 30600,
supp: 0,
priv: 0
}, {
name: 'Education and health services',
drilldown: '650000000',
y: 25500,
supp: 0,
priv: 0
}, {
name: 'Leisure and hospitality',
y: 35400,
supp: 0,
priv: 0
}, {
name: 'Other services',
y: 9200,
supp: 0,
priv: 0
}, {
name: 'Government',
drilldown: '900000000',
y: 39100,
supp: 0,
priv: 0
}];
drilldownSeries = [{
id: '400000000',
name: 'Trade, transportation, and utilities',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Wholesale Trade',
y: 6900,
supp: 0,
priv: 0
}, {
name: 'Retail trade',
y: 36000,
drilldown: '420000000',
supp: 0,
priv: 0
}, {
name: 'Transportation and warehousing',
y: 4100,
supp: 0,
priv: 0
}]
}, {
id: '420000000',
name: 'Retail trade',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Food and beverage stores',
y: 7200,
supp: 0,
priv: 0
}, {
name: 'General merchandise stores',
y: 6200,
supp: 0,
priv: 0
}]
}, {
id: '650000000',
name: 'Education and health services',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Hospitals',
y: 0.0,
supp: 0,
priv: 0
}]
}, {
id: '900000000',
name: 'Government',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Federal',
y: 2500,
supp: 0,
priv: 0
}, {
name: 'State government',
y: 4000,
supp: 0,
priv: 0
}, {
name: 'Local government',
y: 32600,
supp: 0,
priv: 0
}]
}, {
id: '400000001',
name: 'Trade, transportation, and utilities',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Wholesale Trade',
y: 4200,
supp: 0,
priv: 0
}, {
name: 'Retail trade',
y: 23800,
drilldown: '420000001',
supp: 0,
priv: 0
}, {
name: 'Transportation and warehousing',
y: 2000,
supp: 0,
priv: 0
}]
}, {
id: '420000001',
name: 'Retail trade',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Food and beverage stores',
y: 5000,
supp: 0,
priv: 0
}, {
name: 'General merchandise stores',
y: 4900,
supp: 0,
priv: 0
}]
}, {
id: '650000001',
name: 'Education and health services',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Hospitals',
y: 7500,
supp: 0,
priv: 0
}]
}, {
id: '900000001',
name: 'Government',
showInLegend: false,
yAxis: 0,
tooltip: {
valueDecimals: 0
},
seriesHasSupp: false,
chartLoc: 'chartMain',
data: [{
name: 'Federal',
y: 1100,
supp: 0,
priv: 0
}, {
name: 'State government',
y: 2900,
supp: 0,
priv: 0
}, {
name: 'Local government',
y: 16300,
supp: 0,
priv: 0
}]
}];
// Get references for all the
drilldownSeriesAssoc = [];
$.each(drilldownSeries, function(i, series){
drilldownSeriesAssoc[series.id] = series;
});
console.log(drilldownSeriesAssoc);
$.each(deltonaData, function(i, topic){
if(topic.drilldown){
topic.drilldown = drilldownSeriesAssoc[topic.drilldown];
}
});
console.log(deltonaData);
$.each(capeData, function(i, topic){
if(topic.drilldown){
topic.drilldown = drilldownSeriesAssoc[topic.drilldown];
}
});
console.log(capeData);