在以下示例中,最后一个标签未按预期显示。有12个值对和12个标签。我希望最后一个标签是指定的标签,而不是显示索引12.
http://jsfiddle.net/chrizzl/9eN2C/
OR:
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id='chart1994257d6b2b' class='highcharts'></div>
<script type='text/javascript'>
(function($){
$(function () {
var chart = new Highcharts.Chart({
"dom": "chart1994257d6b2b",
"width": 800,
"height": 400,
"yAxis": {"labels": {"enabled": true},"min":0},
"xAxis": {"categories": [ "KW 1", "KW 2", "KW 3", "KW 4", "KW 5", "KW 6", "KW 7", "KW 8", "KW 9", "KW 10", "KW 11", "KW 12" ],
"labels": {"overflow": "justify", "enabled": true,
"rotation": -45,
"y": 20,
"align": "right"
},
"tickmarkPlacement": "on",
"tickInterval": 2
},
"series": [{"data": [
[1,74],[2,60],[3,79],[4,94],[5,90],[6,83],[7,120],[8,90],[9,90],[10,29],[11,70],[12,66 ]],
"type": "line",
"name": "Test"
}],
"id": "chart1994257d6b2b",
"chart": {"renderTo": "chart1994257d6b2b"}
});
});
})(jQuery);
答案 0 :(得分:1)
类别“编号”基于零,您的系列是基于一个,修改系列索引:
series": [{"data": [
[0,74],[1,60],[2,79],[3,94],[4,90],[5,83],[6,120],[7,90],[8,90],[9,29],[10,70],[11,66]
],
"type": "line",
"name": "Test"
}]
更新了fiddle。