0
我需要在某個日期跨度下面的圖表的x軸上觸發縮放,但我無法使其工作。我已經嘗試過setExtremes,但一定是做錯了。參考文獻link。Highcharts xaxis datetime zoom
var options = {
chart: {
renderTo: 'chart',
type: 'spline',
zoomType: 'x'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b' }
},
series: [{"name":2014,"data":[[1451689200000,11350],[1451775600000,12205],[1452121200000,39281],[1452207600000,18070],[1452294000000,35320],[1452380400000,53769],[1452639600000,93910],[1452726000000,110625],[1452812400000,138256],[1452898800000,159279],[1452985200000,265270],[1453244400000,331918],[1453330800000,395227],[1453417200000,411964],[1453503600000,418536],[1453590000000,424046],[1453849200000,458847],[1453935600000,513330],[1454022000000,587488],[1454108400000,625135],[1454194800000,679873],[1454367600000,680253],[1454454000000,933778],[1454540400000,991916],[1454626800000,1006278],[1454713200000,1016718],[1454799600000,1055815],[1455058800000,1129627],[1455145200000,1242090],[1455231600000,1239884],[1455318000000,1351267],[1455404400000,1387952],[1455663600000,1545140],[1455750000000,1572155],[1455836400000,1605175],[1455922800000,1650532],[1456009200000,1662004],[1456268400000,1745892],[1456354800000,1805872],[1456441200000,1821161],[1456527600000,1975775],[1456614000000,1999647],[1456959600000,2159301],[1457046000000,2181772],[1457132400000,2209388],[1457218800000,2246724],[1457305200000,2263724],[1457564400000,2419572],[1457650800000,2448587],[1457737200000,2464894],[1457823600000,2483780],[1457910000000,2248279],[1458169200000,2319485],[1458255600000,2344850],[1458342000000,2384711]]},{"name":2015,"data":[[1451689200000,4248],[1451948400000,4535],[1452121200000,39815],[1452207600000,162618],[1452294000000,163877],[1452553200000,245042],[1452639600000,283307],[1452726000000,300121],[1452812400000,315588],[1452898800000,338774],[1453158000000,362234],[1453244400000,431197],[1453330800000,462865],[1453417200000,542854],[1453503600000,534652],[1453762800000,659993],[1453849200000,710551],[1453935600000,714293],[1454022000000,716233],[1454108400000,721196],[1454281200000,722647],[1454367600000,820636],[1454454000000,869842],[1454540400000,806982],[1454626800000,812370],[1454713200000,823451],[1454972400000,932555],[1455058800000,955538],[1455145200000,982632],[1455231600000,1019371],[1455318000000,1019963],[1455577200000,1026433],[1455663600000,1092826],[1455750000000,1151110],[1455836400000,1199288],[1455922800000,1229745],[1456182000000,1320812],[1456268400000,1343164],[1456354800000,1374927],[1456441200000,1383695],[1456527600000,1387348],[1456873200000,1455544],[1456959600000,1459032],[1457046000000,1477502],[1457132400000,1504972],[1457218800000,1493784],[1457478000000,1515794],[1457564400000,1537505],[1457650800000,1557304],[1457737200000,1576530],[1457823600000,1607676],[1458082800000,1926954],[1458169200000,1929888],[1458255600000,2048450],[1458342000000,2048734],[1458428400000,2102372],[1458687600000,2141230],[1458774000000,2134977],[1458860400000,2165481],[1458946800000,2205192],[1459033200000,2209522],[1459288800000,2238011],[1459375200000,2225085],[1459461600000,2409795]]},{"name":2016,"data":[[1451862000000,207123],[1451948400000,239140],[1452121200000,275052],[1452207600000,323532],[1452466800000,372982],[1452553200000,459132],[1452639600000,495179],[1452726000000,620520],[1452812400000,684410],[1453071600000,815275],[1453158000000,957924],[1453244400000,961317],[1453330800000,988875],[1453417200000,1046809],[1453676400000,1086961],[1453762800000,1154402],[1453849200000,1181830],[1453935600000,1221501],[1454022000000,1276541],[1454281200000,1360211],[1454367600000,1376106],[1454454000000,1468821],[1454540400000,1508707],[1454626800000,1532112],[1454886000000,1588363],[1454972400000,1603510],[1455058800000,1666535],[1455145200000,1731314],[1455231600000,1959197],[1455490800000,2060951],[1455577200000,2079226],[1455663600000,2111278],[1455750000000,2116369],[1455836400000,2133023],[1456095600000,2183282],[1456182000000,2249355],[1456268400000,2254414],[1456354800000,2261002],[1456441200000,2262186],[1456700400000,2306500],[1456786800000,2431515],[1456873200000,2445178]]}]
};
var chart = $('#chart').highcharts(options);
能告訴你怎麼使用'setExtremes'?我的意思是,它適用於我:https://jsfiddle.net/wkunsgLw/2/ –
完全像你,但沒有「highcharts()」。謝謝:) 重新發布您的答案,我會標記爲已解決並給予積分。 – fish