有放在一起的簡單圖,其中是從所提供的數據進行編譯Highcharts:日期格式從UNIX
$(function() {
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
credits: {
enabled: false
},
title: {
text: 'Chart'
},
xAxis: {
type: 'datetime'
},
rangeSelector: {
buttonTheme: { // styles for the buttons
fill: 'none',
stroke: 'none',
style: {
color: '#039',
fontWeight: 'bold'
},
states: {
hover: {
fill: 'white'
},
select: {
style: {
color: 'white'
}
}
}
},
inputStyle: {
color: '#039',
fontWeight: 'bold'
},
labelStyle: {
color: 'silver',
fontWeight: 'bold'
},
selected: 1
},
series: [{
name: 'Data',
data: [
[1325376000,102.2],
[1328054400,104.5],
[1330560000,106.7],
[1333238400,109.8],
[1335830400,122.1],
[1338508800,124.3],
]
}]
});
});
然而,日期數據(例如1325376000)簡單地呈現爲在x軸小時圖表和頂部顯示的日期顯示爲1970年...您能告訴我我哪裏出錯了嗎?非常感謝。
我使用網站轉換日期。看看這裏:http://jsfiddle.net/bGBpg/ – user2168745 2013-03-19 14:03:39
這jsfiddle不適合我。日期數字看起來很小。嘗試乘以1000以轉換爲毫秒。 – SteveP 2013-03-19 14:35:31