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

如何使用highcharts(highstock)显示年-周格式数据?;,highcharts,highstock,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

事实上,我的数据是每周数据。 该数据为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年的第一周到第五十周,但如何修改我的代码?

我找不到“pointStart”的年-周格式数据,如何设置“pointInterval”值为“weekly”?

我的代码:

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

$(函数(){
$(“#容器”).highcharts('StockChart'{
图表:{
zoomType:'xy'
},
标题:{
文本:“测试”
},
亚克斯:{
滚动条:{
启用:对,
炫耀:假
}
},
工具提示:{
分割:假
},
系列:[{
名称:'Emloye1',
数据:[
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
],
起点:UTC日期(2015,0,1),
点间距:24*3600*1000*7
}]
});
});
我的代码的效果:

检查并设置容器
最小宽度

演示


您的要求在本帖中得到了准确的解决

此参考资料可能会帮助您:您好,先生!事实上,我希望X轴显示周,如“2015-01(周)、2015-02(周)、2015-52(周)”。当我像您一样修改代码时,X轴总是显示年-月格式,为什么?如何设置最小宽度?它是图表容器宽度
 dataGrouping: {
    forced: true,
    units: [
      ['week', [1]]
    ]
  }