chart work

This commit is contained in:
Tom Slater 2019-08-28 10:47:44 +01:00
parent 5e91665e0b
commit 420174e953
2 changed files with 3 additions and 16 deletions

View file

@ -53,7 +53,7 @@
<h4 class="card-title mb-0">Supplier Spend History</h4> <h4 class="card-title mb-0">Supplier Spend History</h4>
</div> </div>
<div class="col-sm-4 hidden-sm-down"> <div class="col-sm-4 hidden-sm-down">
<button (click)="supplierChartUpdate()">New Suppliers</button> <button type="button" class="btn btn-info" (click)="supplierChartUpdate()">New Suppliers</button>
</div> </div>
</div> </div>
<div> <div>

View file

@ -18,6 +18,7 @@ export class MoreStuffComponent implements OnInit {
bubbleChartEnd: any; bubbleChartEnd: any;
cached_graph_data: any; cached_graph_data: any;
isBubbleChartLoaded = false; isBubbleChartLoaded = false;
isLineChartLoaded = false;
constructor( constructor(
private api: ApiService, private api: ApiService,
@ -30,7 +31,7 @@ export class MoreStuffComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.loadYearSpend(); this.loadYearSpend(false, ('0'), ('0'));
this.loadSupplierBubble(false, ('0'), ('0')); this.loadSupplierBubble(false, ('0'), ('0'));
this.loadSupplierHistory(); this.loadSupplierHistory();
} }
@ -62,22 +63,8 @@ export class MoreStuffComponent implements OnInit {
let graph_data = []; let graph_data = [];
if (useRange == true) { if (useRange == true) {
// console.log("using range " + start_range + " : " + end_range);
passed_graph_data.data.map(item=> { passed_graph_data.data.map(item=> {
let is_item_in_range = (new Date(item.date.substring(0, 10)) >= new Date(start_range) && new Date(item.date.substring(0, 10)) <= new Date(end_range)); let is_item_in_range = (new Date(item.date.substring(0, 10)) >= new Date(start_range) && new Date(item.date.substring(0, 10)) <= new Date(end_range));
// there are a lot of `new Date(blah)` but that is what works for some reason.
// console.log("item.date : " + (item.date));
// console.log("Date(item.date) : " + new Date(item.date));
// console.log("Date(item.date.substring(0, 10)) : " + new Date(item.date.substring(0, 10)));
// console.log("start_range input box: " + start_range);
// console.log("start_range : " + new Date(start_range));
// console.log("end_range input box: " + end_range);
// console.log("end_range : " + new Date(end_range));
// console.log("item.date >= start_range: " + (new Date(item.date) >= new Date(start_range)));
// console.log("item.date <= end_range: " + (new Date(item.date) <= new Date(end_range)));
// console.log("is_item_in_range: " + is_item_in_range);
// console.log("----------------------");
if (is_item_in_range) { if (is_item_in_range) {
graph_data.push({ graph_data.push({