如何使用highcharts(highstock)显示年周格式数据?

时间:2018-04-21 02:36:58

标签: highcharts highstock

事实上,我的数据是每周数据。 该数据来自2015年的第1周至第50周。

data: [
        1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
       ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
       ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
       ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
       ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
    ]

我想在X轴上显示2015年的第一周到第50周,但是如何修改我的代码?

我找不到" pointStart"的年 - 周格式数据,以及如何设置" pointInterval"价值是每周?

我的代码:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">    
<script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
<script src="https://img.hcharts.cn/highstock/highstock.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_EN.js"></script>
</head>
<body>
    <div id="container" style="height: 400px; min-width: 600px"></div>
    <script>
    $(function () {
        $('#container').highcharts('StockChart', {
            chart: {
                zoomType: 'xy'
            },
            title: {
                text: 'test'
            },

            yAxis: {
                scrollbar: {
                    enabled: true,
                    showFull: false
                }
            },
            tooltip: {
                split: false
            },

            series: [{
                name:'emloyee1',
                data: [
                  1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
                 ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
                 ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
                 ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
                 ,1884,2936,2039,1948,1814,2071,2183,3234,3426,2188
                ],
                pointStart: Date.UTC(2015,0, 1),
                pointInterval: 24 * 3600 * 1000 * 7
            }]
        });

});
</script>
</body>
</html>

我的代码的影响: enter image description here

1 个答案:

答案 0 :(得分:1)

检查data-grouping并设置容器 try { layer = new KmlLayer(mGoogleMap,R.raw.del, getApplicationContext()); // creating the kml layer layer.addLayerToMap();// adding kml layer with the **google map** Log.i("KML:","Loaded"); }

min-width

fiddle demo

您的要求已在此SO帖子

中得到完全解决