From 84961310c3df0c5125aa9b0e5646cdb1e656514b Mon Sep 17 00:00:00 2001 From: "Ruben Hartenstein (PEA4-Fe)" Date: Thu, 7 Jan 2021 12:25:14 +0100 Subject: [PATCH] Increase sample size in dashboard --- src/app/home/home.component.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 792bf95..7031895 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,8 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import {LoginService} from '../services/login.service'; +import { LoginService } from '../services/login.service'; import { ApiService } from '../services/api.service'; -import {Chart} from 'chart.js'; - +import { Chart } from 'chart.js'; interface KeyInterface { @@ -30,8 +29,7 @@ export class HomeComponent implements OnInit { ngOnInit() { // fetch all available groups this.fetchData('/material/groups', data => this.createGroup(data)); - //this.initChart(); - console.log(this.login.username); + //console.log(this.login.username); } // api access with callback @@ -46,12 +44,12 @@ export class HomeComponent implements OnInit { let temp: KeyInterface[] = []; for (var i = 0; i < data.length; i++) { - temp.push({ id: data[i], count: 0, active: false }); + temp.push({ id: data[i], count: 0, active: true }); } this.keys = temp; // invoke update in rb-multiselect this.calcFieldSelectKeys(); // fetch all samples populated with according group - this.fetchData('/samples?status%5B%5D=validated&status=new&page-size=10&sort=_id-asc&fields%5B%5D=material.group', data => this.countSamples(data)); + this.fetchData('/samples?status%5B%5D=validated&status=new&sort=_id-asc&fields%5B%5D=material.group', data => this.countSamples(data)); } // loop through samples and count @@ -95,7 +93,7 @@ export class HomeComponent implements OnInit { dataList.push(key.count); } }) - return { names: nameList, data: dataList }; + return { names: nameList, count: dataList }; } // draw graph @@ -118,9 +116,10 @@ export class HomeComponent implements OnInit { labels: data.names, datasets: [{ label: 'Number of samples per group', - data: data.data, + data: data.count, backgroundColor: fillPattern, - borderWidth: 2 + pointRadius: 4, + pointHoverRadius: 7 }] }, options: {