-1
下面是代碼鏈接:https://jsfiddle.net/chong789456/a77pj67b/3/Highcharts堆棧列問題
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ["c1", "c2", "c3", "c4"],
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
}
},
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: {
useHTML: true,
formatter: function() {
var tooltip = '';
tooltip = '<b style="color:' + this.point.series.color + ';">Type: </b>' + this.point.series.name + '<br>';
tooltip += '<b style="color:' + this.point.series.color + ';">Clicks: </b>' + Highcharts.numberFormat(this.point.y, 0, '.', ',') + '<br>';
return tooltip;
}
},
plotOptions: {
column: {
stacking: 'normal'
},
series: {
minPointLength: 10
}
},
series: [
{
color: '#8fdc87',
name: 'orange',
data: [
14943,0,3857,34
]
},{
color: '#7CB5EC',
name: 'apple',
data: [
0,0,0,0
]
},
],
});
我有4個類別(C1,C2,C3,C4)和2系列(橙,蘋果)。
問題是,對於類別c4,橙色的數字是34,蘋果的數字是0,只有蘋果show4在c4,你可以在圖表中看到。我想橙色顯示有和工具提示也應該顯示類似: 類型:橙色 瀏覽次數:34
我感到困惑的是橙色不C4顯示爲它的點擊是不爲0,任何人都可以幫忙嗎?謝謝噸!
============================================== ===
我已經解決了這個問題吧! :)這裏是鏈接: https://jsfiddle.net/75zk3w08/1/
series: [
{
color: '#8fdc87',
name: 'orange',
data: [
14943,null,3857,34
]
},{
color: '#7CB5EC',
name: 'apple',
data: [
null,null,null,null
]
},
],
唯一不同的這些2個例子是串聯部。如果我將該值設置爲空,那麼它將不會顯示在圖表中。
https://jsfiddle.net/gourav012/a77pj67b/6/ – Gourav
嗨Gourav,我已經通過設置系列值爲null解決了這個問題。但是,仍然感謝您的幫助:) – Chong