我目前有这个,
data.dataLabels = { formatter : function(){ if( this.point.y != 0 ){ return this.point.y; } } };
chart = new Highcharts.Chart(data);
这是在question中建议的,我尝试使用上面提到的但是它不起作用,它仍然显示值为0.任何帮助?提前谢谢。
修改
我的实际代码如下所示,
jQuery.ajax({
url:"charts/bar_chart.php",
dataType: "json",
cache: false,
data:{"tid":"<?php print $q4tid ?>"}
}).done(
function(data) {
data.chart["renderTo"] = "q4chart";
<?php if($q4title!="") { ?>
data.title["text"] = "<?php print $q4title ?>";
<?php } ?>
//calculate approximate heigt of chart. this is needed because
//highchart calcluate chart height based on offset height.
var ah = data.xAxis.categories.length * (data.series.length*15);
jQuery("#q4chart").css("height", ah+"px");
data.dataLabels = { formatter : function(){ if( this.point.y != 0 ){ return this.point.y; } } };
chart = new Highcharts.Chart(data);
//resize parent frame
resizeFrame();
}
).fail(
function(jqXHR, textStatus, errorThrown) {
jQuery("#q4chart").html("Error loading Q4 chart, please contact administrator.<br />" + errorThrown);
//alert("Error loading Q4 Bar chart:" + errorThrown);
}
);