import { Component, OnInit } from '@angular/core'; import {CacheService} from '../cache.service'; @Component({ selector: 'app-table-overview', templateUrl: './table-overview.component.html', styleUrls: ['./table-overview.component.css'] }) export class TableOverviewComponent implements OnInit { public subplots; constructor(private service: CacheService) { } ngOnInit(): void { this.service.onNewTables.subscribe(() => this.createPlots()); } public get tables() { return this.service.tables; } createPlots() { this.subplots = []; for (const tableIndex in this.tables) { const table = this.tables[tableIndex]; this.subplots.push( { data: [{ x: Object.keys(table.entries).map((hash: string) => { return hash; } ), y: Object.values(table.entries).map((values: number[]) => values.length / this.service.windows.length), type: 'bar' }], layout: { hovermode: 'closest', autosize: true, margin: { l: 10, r: 10, t: 10, b: 10, pad: 4 }, xaxis: { showticklabels: false }, yaxis: { showticklabels: false }, height: 100, width: screen.width * 0.1, } } ); } } }