IT WORKS! (date range picker)
This commit is contained in:
parent
6f801d20de
commit
ab72264521
1 changed files with 6 additions and 2 deletions
|
@ -108,8 +108,10 @@ export class MoreStuffComponent implements OnInit {
|
||||||
|
|
||||||
var is_cached = false;
|
var is_cached = false;
|
||||||
|
|
||||||
|
console.log(this.cached_graph_data);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.cached_graph_data.length > 0) {
|
if (this.cached_graph_data) {
|
||||||
is_cached = true;
|
is_cached = true;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -117,15 +119,17 @@ export class MoreStuffComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_cached) {
|
if (is_cached) {
|
||||||
|
console.log("Using cached data of " + this.cached_graph_data.length + " items.");
|
||||||
this.supplierBubbleChartData[0].data = this.formatGraphData(this.cached_graph_data, useRange, start_range, end_range);
|
this.supplierBubbleChartData[0].data = this.formatGraphData(this.cached_graph_data, useRange, start_range, end_range);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log("Not using cached data.");
|
||||||
this.api.loadMiscUrl('organisation/external/supplier_count').subscribe(
|
this.api.loadMiscUrl('organisation/external/supplier_count').subscribe(
|
||||||
result => {
|
result => {
|
||||||
this.cached_graph_data = result;
|
this.cached_graph_data = result;
|
||||||
|
|
||||||
this.supplierBubbleChartData[0].data = this.formatGraphData(result, useRange, start_range, end_range);
|
this.supplierBubbleChartData[0].data = this.formatGraphData(result, useRange, start_range, end_range);
|
||||||
console.log("Graph fetched with " + this.cached_graph_data.length + " items.");
|
console.log("Graph fetched with " + this.supplierBubbleChartData[0].data.length + " items.");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue