我对angular还是陌生的,需要执行一项任务。
任务是从quandl api获取数据并 缓存 ..... ????。在高图散点图上以及单击清除缓存按钮时显示它。清除缓存。
上次我只使用了简单的http调用:
getData(url= 'https://www.quandl.com/api/v3/datasets/WIKI/AAPL.json?api_key=ifgfg,fg'){
this.http.get(url).subscribe(data => {
this.dataAll = data;
this.dataArray = this.dataAll.dataset.data;
this.currentDate = new Date().toString();
this.currentDate = new Date(this.currentDate).toUTCString();
this.currentDate = this.currentDate.split(' ').slice(0, 5).join(' ');
this.dataArray.forEach((da) => da.forEach((element, index) => {if ( index === 0){da[index] = new Date(element).getTime() ; } }));
this.newDataArr = this.dataArray.reverse();
Highstock.stockChart('container', {
rangeSelector: {
selected: 3,
allButtonsEnabled: true,
buttons: [{
type: 'week',
count: 1,
text: 'Week',
dataGrouping: {
forced: true,
units: [['day', [1]]]
}
}, {
type: 'month',
count: 1,
text: 'month',
dataGrouping: {
forced: true,
units: [['week', [1]]]
}
}, {
type: 'month',
count: 3,
text: '3 months',
dataGrouping: {
forced: true,
units: [['week', [1]]]
}
}, {
type: 'month',
count: 6,
text: '6 months',
dataGrouping: {
forced: true,
units: [['week', [1]]]
}
}, {
type: 'year',
count: 3,
text: 'year',
dataGrouping: {
forced: true,
units: [['week', [1]]]
}
}, {
type: 'all',
text: 'All',
dataGrouping: {
forced: true,
units: [['month', [1]]]
}
}],
buttonTheme: {
width: 60
},
},
title: {
text: this.currentTicker + ' Last queried on: ' + this.currentDate
},
series: [{
type: 'ohlc',
name: this.currentTicker + ' Stock Price',
data: this.newDataArr,
dataGrouping: {
units: [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
}]
});
});
我对清除此处的缓存不感到困惑。谁能在清除缓存部分上帮我...。这可能意味着什么?