Increase sample size in dashboard
This commit is contained in:
		| @@ -1,8 +1,7 @@ | |||||||
| import { Component, OnInit } from '@angular/core'; | 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 { ApiService } from '../services/api.service'; | ||||||
| import {Chart} from 'chart.js'; | import { Chart } from 'chart.js'; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| interface KeyInterface { | interface KeyInterface { | ||||||
| @@ -30,8 +29,7 @@ export class HomeComponent implements OnInit { | |||||||
|   ngOnInit() { |   ngOnInit() { | ||||||
|     // fetch all available groups   |     // fetch all available groups   | ||||||
|     this.fetchData('/material/groups', data => this.createGroup(data)); |     this.fetchData('/material/groups', data => this.createGroup(data)); | ||||||
|     //this.initChart(); |     //console.log(this.login.username); | ||||||
|     console.log(this.login.username); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // api access with callback |   // api access with callback | ||||||
| @@ -46,12 +44,12 @@ export class HomeComponent implements OnInit { | |||||||
|     let temp: KeyInterface[] = []; |     let temp: KeyInterface[] = []; | ||||||
|  |  | ||||||
|     for (var i = 0; i < data.length; i++) { |     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.keys = temp; // invoke update in rb-multiselect | ||||||
|     this.calcFieldSelectKeys(); |     this.calcFieldSelectKeys(); | ||||||
|     // fetch all samples populated with according group |     // 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 |   // loop through samples and count | ||||||
| @@ -95,7 +93,7 @@ export class HomeComponent implements OnInit { | |||||||
|         dataList.push(key.count); |         dataList.push(key.count); | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|     return { names: nameList, data: dataList }; |     return { names: nameList, count: dataList }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // draw graph |   // draw graph | ||||||
| @@ -118,9 +116,10 @@ export class HomeComponent implements OnInit { | |||||||
|           labels: data.names, |           labels: data.names, | ||||||
|           datasets: [{ |           datasets: [{ | ||||||
|             label: 'Number of samples per group', |             label: 'Number of samples per group', | ||||||
|             data: data.data, |             data: data.count, | ||||||
|             backgroundColor: fillPattern, |             backgroundColor: fillPattern, | ||||||
|             borderWidth: 2 |             pointRadius: 4, | ||||||
|  |             pointHoverRadius: 7 | ||||||
|           }] |           }] | ||||||
|         }, |         }, | ||||||
|         options: { |         options: { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user