I'm working with the highcharts library using the "Dona" type graphic. The point is that I divided it into categories within the categories and I need to hide one of them and I can not do it. Thank you in advance.
example: link
var colors = Highcharts.getOptions().colors,
categories = [
"Cumple", //OCULTAR SUBCATGORIA,
"No Cumple"
],
data = [
{
"y": 70,
"color": "#e6b54a",
"drilldown": {
"name": "Cumple",// SUBCATEGORIA INICIO,
"categories": [
"DATO 1",
"DATO 2"
],
"data": [
50,
20
],// SUBCATEGORIA FIN
}
},
{
"y": 30,
"color": '#850f5b',
"drilldown": {
"name": "No Cumple",
"categories": [
"> 0",
"Limite"
],
"data": [
20,
10
]
}
}
],
browserData = [],
versionsData = [],
i,
j,
dataLen = data.length,
drillDataLen,
brightness;
// Build the data arrays
for (i = 0; i < dataLen; i += 1) {
// add browser data
browserData.push({
name: categories[i],
y: data[i].y,
color: data[i].color
});
// add version data
drillDataLen = data[i].drilldown.data.length;
for (j = 0; j < drillDataLen; j += 1) {
brightness = 0.2 - (j / drillDataLen) / 5;
versionsData.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
Highcharts.chart('chartConectadas', {
chart: {
type: 'pie'
},
title: {
text: ''
},
subtitle: {
text: ''
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'DATO',
data: browserData,
size: '50%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'DATO',
data: versionsData,
size: '50%',
innerSize: '70%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' +
this.y + '%' : null;
}
},
id: 'versions'
}],
responsive: {
rules: [{
condition: {
maxWidth: 400
},
chartOptions: {
series: [{
id: 'versions',
dataLabels: {
enabled: false
}
}]
}
}]
}
});