在這裏我得到最新的陣列/時間紀元如何時代轉換爲角可讀日期在憲章使用
ApiFactory.getTweetQuotes(the_ticker).then(function(data) {
// Create epoch array:
for (var i = 0; i < data.data.quotes.length; i++) {
vs.tweet_epochs.push(data.data.quotes[i].start_epoch);
}
console.log(vs.tweet_epochs);
initChart();
vs.loadingChart = true;
});
vs.tweet_epochs
看起來像這樣安慰了:
我中號使用Chartist,它不是在此刻打印出來很漂亮:
我在這裏找到了這個答案Convert UTC Epoch to local date with javascript然而它只是增加了3個0
的每個時代,而不是將它們轉換成日期。
如果需要Charist代碼:
var initChart = function() {
var data = {
labels: vs.tweet_epochs,
series: [
vs.tweet_vol
]
};
// Chart options:
var options = {
showPoint: true,
showArea: true,
lineSmooth: true,
fullWidth: true,
axisX: {
showGrid: false,
showLabel: true
},
axisY: {
offset: 40,
labelInterpolationFnc: function(value) {
return '$' + value;
}
}
};
var chart = new Chartist.Line('.ct-chart', data, options);
}
謝謝你會檢查出來... –