我正在尝试使用Highcharts构建折线图,但x轴会按周而不是给定日期自动分组。
这是我的小提琴。
http://jsfiddle.net/3f6s8h0j/1/
count1 = [16228698,15917216,11957588,12934077,13811492,14206230,15423527,19311077,17067468,13347063,13116311,13243010,14183571,15177138,18853605,16700250,10417138,12664143,14218499,13462101,15297893,18368919,16913298,13104511,13158407,12795561,13473354,15727013,18648946,16436202,13478626,12846478,13459858,13905952,14503101,18439064,16502832,12110670,12788311,12622685,13524902,14856760,18502559,17488800,12884122,12908184,11962362,12259889,14886297,18019254,15429555,12563583,12424331,12781565,12930710,14356349,18480816,16283296,13639307,14365308,16859336,14831249,17837084,17468046,15981451,12577034,12813868,13146116,12609163,14016591,17662082,16097146,12607021,11934206,12988569,13325518,14630264,18835488,16682453,13009659,12229220,13267589,13820152,15138572,19248763,16943640,14091944,14276304,14777351,14884606,16448727,15657489,14295587,15721346,15161364,15369301,15895042,15466172,15547058,16177130,16306299,14350758,13840218,12969487,14352949,19062891,16612301,12421908,12687346,13248560,13376225,17341400,16711020,16041817,13271102,13390452,13299561,13769044,18735051,16448802,13106327,12865638,12975123,13066014,14859050,19256606,18273368,12788716,12763821,12996526,13128572,19329514,14480838,13114877,13163881,12936459,15333416,14943045,19057804,18353974,13133296,12038864,13420675,13619426,15494769,19116937,19014927,16420879,13782967,13767068,13545488,14885284,19758043,17464801,12869734,12658658,13106023,13486071,14897579,19203965,18131636,13209473,13337083,13589103,13677222,15564308,20028491,17738460,13987791,16553474,14515369,13573517,14691655,12961929,13047650,13043837,13364289,14212280,18260059,17849895,13496657,13417288,13189974]
count2 = [26309765,26309902,19640817,21204555,22534515,22977976,25210121,31734505,17443105,7482293,21408599,21417170,23019943,24767277,30864080,27378658,22579569,20396918,22816920,21503747,24764233,29972790,27539221,13443950,7940500,20467182,21833411,25428594,30342520,26686974,21691186,20630207,21529418,22173619,23309381,29823994,19037374,7229745,20049112,20170003,21443566,24287510,29831070,27825026,20470735,20887823,19093614,19215949,23476216,28953079,24766428,19950360,19700596,20132716,20315730,22855130,29612118,26114397,21690098,19349351,20596350,23762871,28690541,28125793,25691011,19741793,20295238,20751903,19796046,22288708,28306196,25759759,19955328,18987336,20597293,21015977,23332275,30177946,26698399,20650973,19295397,21049856,21995427,24283689,31029635,27551673,22657767,22967892,23900603,24035756,26662487,25420773,23353197,25434029,24494870,24735639,25638379,25020716,25088099,26457133,26351389,23000090,22079471,20557926,22916472,30563761,26722292,19806969,20178080,20903344,21057153,27765081,26809415,25587465,21036072,21054600,20931778,21911569,29924459,26247603,20773695,20353399,20341424,20688302,23780127,30718057,29184175,20238772,20425671,20469427,20649486,30521236,22780084,20716345,20591831,20100428,23870531,23410576,30093672,28885955,20572213,18785043,20760594,21106288,24327852,30647278,30296796,27883370,21548897,21248710,20986131,23255972,20672434,13067727,16296330,12472994,20361775,21103261,23260183,30221710,28470853,20471506,20588534,20138372,20437561,23091636,30142213,27776704,21572013,25806927,22468765,21264160,22778550,20009681,15629143,20258279,20492553,22088047,18769301,7768021,13534438,9735718,13255392]
dates = ["2016/9/23","2016/9/24","2016/9/25","2016/9/26","2016/9/27","2016/9/28","2016/9/29","2016/9/30","2016/10/1","2016/10/2","2016/10/3","2016/10/4","2016/10/5","2016/10/6","2016/10/7","2016/10/8","2016/10/9","2016/10/10","2016/10/11","2016/10/12","2016/10/13","2016/10/14","2016/10/15","2016/10/16","2016/10/17","2016/10/18","2016/10/19","2016/10/20","2016/10/21","2016/10/22","2016/10/23","2016/10/24","2016/10/25","2016/10/26","2016/10/27","2016/10/28","2016/10/29","2016/10/30","2016/10/31","2016/11/1","2016/11/2","2016/11/3","2016/11/4","2016/11/5","2016/11/6","2016/11/7","2016/11/8","2016/11/9","2016/11/10","2016/11/11","2016/11/12","2016/11/13","2016/11/14","2016/11/15","2016/11/16","2016/11/17","2016/11/18","2016/11/19","2016/11/20","2016/11/21","2016/11/22","2016/11/23","2016/11/24","2016/11/25","2016/11/26","2016/11/27","2016/11/28","2016/11/29","2016/11/30","2016/12/1","2016/12/2","2016/12/3","2016/12/4","2016/12/5","2016/12/6","2016/12/7","2016/12/8","2016/12/9","2016/12/10","2016/12/11","2016/12/12","2016/12/13","2016/12/14","2016/12/15","2016/12/16","2016/12/17","2016/12/18","2016/12/19","2016/12/20","2016/12/21","2016/12/22","2016/12/23","2016/12/24","2016/12/25","2016/12/26","2016/12/27","2016/12/28","2016/12/29","2016/12/30","2016/12/31","2017/1/1","2017/1/2","2017/1/3","2017/1/4","2017/1/5","2017/1/6","2017/1/7","2017/1/8","2017/1/9","2017/1/10","2017/1/11","2017/1/13","2017/1/14","2017/1/15","2017/1/16","2017/1/17","2017/1/18","2017/1/19","2017/1/20","2017/1/21","2017/1/22","2017/1/23","2017/1/24","2017/1/25","2017/1/26","2017/1/27","2017/1/28","2017/1/29","2017/1/30","2017/1/31","2017/2/1","2017/2/3","2017/2/4","2017/2/5","2017/2/6","2017/2/7","2017/2/8","2017/2/9","2017/2/10","2017/2/11","2017/2/12","2017/2/13","2017/2/14","2017/2/15","2017/2/16","2017/2/17","2017/2/18","2017/2/19","2017/2/20","2017/2/21","2017/2/22","2017/2/23","2017/2/24","2017/2/25","2017/2/26","2017/2/27","2017/2/28","2017/3/1","2017/3/2","2017/3/3","2017/3/4","2017/3/5","2017/3/6","2017/3/7","2017/3/8","2017/3/9","2017/3/10","2017/3/11","2017/3/12","2017/3/13","2017/3/14","2017/3/15","2017/3/16","2017/3/19","2017/3/20","2017/3/21","2017/3/22","2017/3/23","2017/3/24","2017/3/25","2017/3/26","2017/3/27","2017/3/28"]
Highcharts.chart('container', {
title: {
text: 'Solar Employment Growth by Sector, 2010-2016'
},
subtitle: {
text: 'Source: thesolarfoundation.com'
},
xAxis: {
categories: dates,
type: 'datetime'
},
yAxis: {
title: {
text: 'Number of Employees'
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle'
},
series: [{
name: 'Installation',
data: count1
}, {
name: 'Manufacturing',
data: count2
}, ]
});