0

在以下示例中,最后一个标签未按预期显示。有 12 个值对和 12 个标签。我希望最后一个标签是指定的标签,而不是显示索引 12。

http://jsfiddle.net/chrizzl/9eN2C/

或者:

<!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);

4

1 回答 1

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" 
  }]

更新了小提琴

于 2013-11-14T14:02:53.863 回答