Açıklamada, efsane öğesi değerinin toplamından çıkarılmasını nasıl önlerim ve bunun yerine değeri başka bir lejant öğesine eklerim.Highcharts Yığın Sütun grafiği değiştir legendItemClick işlevi
E.g. 'Diğer Meyve' serilerinin tüm kapalı meyve serilerini ('Diğer sebzeler' serisiyle aynı) içermesini isterim. Burada
Fiddle$(function() {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ['Then', 'Now']
},
yAxis: {
min: 0,
title: {
text: 'Total consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
series: {
events: {
legendItemClick: function() {
//if fruit/veg is clicked then add value to other fruit/veg and keep the total unchanged
// return false;
}
}
},
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
formatter:function() {
return this.series.name+' '+this.point.y;
},
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
style: {
textShadow: '0 0 3px black'
}
}
}
},
series: [{
name: 'Other Fruit',
data: [8, 13]
},{
name: 'Other Veg',
data: [16, 10]
},{
name: 'Tomatoes',
data: [3, 7]
},{
name: 'Cucumbers',
data: [5, 4]
},{
name: 'Apples',
data: [5, 3]
}, {
name: 'Bananas',
data: [3, 6]
}, {
name: 'Oranges',
data: [3, 4]
}]
});
olup}); Biz diğerleri serisi ("Diğer Meyve" veya "Diğer sebze") elde/çıkarma değer katmak için hangi biliyoruz ki