7
私はHighchartsに取り組んでいます。問題は1つの問題があります。グラフ上のデータに値が存在しない場合、0が表示されます。グラフ上のラベルは、次の関数によって設定されますが、グラフ上に値が0より大きい棒のみが表示されることを確認することはできません。0を削除HIGHCHART
http://jsfiddle.net/CzHyC/3/ [KINDLY]
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'blue'
}
}
},
legend: {
align: 'right',
x: -100,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'gray',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'Total: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: [{
name: 'John',
data: [0, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
});
});
良いトリックが、データはDBからの私のチャートに移入されているが、私はそれにチェックを入れることができます –
はい、ハイチャートに入れる前に特定のフォーマットでデータを構築する必要があります。 – c0deNinja
値をnullに設定しました。 -1は値であるのに対し、-1は値であることに注意してください。 – wergeld