yeet
This commit is contained in:
parent
44c80b062f
commit
efb5888b43
2 changed files with 35 additions and 2 deletions
|
@ -121,6 +121,14 @@ export class DashboardCustomerComponent implements OnInit {
|
||||||
|
|
||||||
// Graph widgets
|
// Graph widgets
|
||||||
public widgetList = [
|
public widgetList = [
|
||||||
|
{
|
||||||
|
type: 'graph',
|
||||||
|
name: 'total_duration',
|
||||||
|
duration: '400',
|
||||||
|
icon: 'icon-diamond',
|
||||||
|
title: '(test) last 400 days',
|
||||||
|
dataType: DataType.currency,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'graph',
|
type: 'graph',
|
||||||
name: 'total_last_week',
|
name: 'total_last_week',
|
||||||
|
|
|
@ -24,7 +24,7 @@ export class MoreStuffComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.loadYearSpend();
|
this.loadYearSpend();
|
||||||
this.loadSupplierBubble();
|
this.loadSupplierBubble(true, new Date('January 1, 2018'), new Date('January 1, 2019')); // pass start and end date ranges to this as Date()s
|
||||||
this.loadSupplierHistory();
|
this.loadSupplierHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +51,32 @@ export class MoreStuffComponent implements OnInit {
|
||||||
* Supplier Bubble Chart Setup
|
* Supplier Bubble Chart Setup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private loadSupplierBubble() {
|
private loadSupplierBubble(bool useRange, Date start_range, Date end_range) {
|
||||||
this.api.loadMiscUrl('organisation/external/supplier_count').subscribe(
|
this.api.loadMiscUrl('organisation/external/supplier_count').subscribe(
|
||||||
result => {
|
result => {
|
||||||
|
|
||||||
|
if (useRange) {
|
||||||
|
let ranged_data = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < ranged_data.data.count; i++) {
|
||||||
|
result.data.map(item => {
|
||||||
|
if (ranged_data.data[i].date >= start_range && ranged_data.data[i].date <= end_range) {
|
||||||
|
ranged_data.push({
|
||||||
|
t: item.date,
|
||||||
|
r: item.value > 1000000 ? (item.value / 1000000) + 10 : (item.value / 100000) + 5,
|
||||||
|
supplier: item.seller,
|
||||||
|
y: item.count,
|
||||||
|
value: item.value,
|
||||||
|
count: item.count,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.supplierBubbleChartData[0].data = ranged_data;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
console.log(result.data);
|
console.log(result.data);
|
||||||
let graph_data = [];
|
let graph_data = [];
|
||||||
result.data.map(item => {
|
result.data.map(item => {
|
||||||
|
@ -68,6 +91,8 @@ export class MoreStuffComponent implements OnInit {
|
||||||
});
|
});
|
||||||
console.log(graph_data);
|
console.log(graph_data);
|
||||||
this.supplierBubbleChartData[0].data = graph_data;
|
this.supplierBubbleChartData[0].data = graph_data;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue