This commit is contained in:
@@ -24,6 +24,22 @@ export interface DashboardStatisticValue {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface EuProjectStatusStatistics {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
ongoing: number;
|
||||
upcoming: number;
|
||||
completed: number;
|
||||
}
|
||||
|
||||
export interface BmbfProjectStatusStatistics {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
ongoing: number;
|
||||
upcoming: number;
|
||||
completed: number;
|
||||
}
|
||||
|
||||
export interface DfgProjectTopic {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -137,6 +153,18 @@ export class DashboardStatisticsService {
|
||||
);
|
||||
}
|
||||
|
||||
getEuProjectStatuses(): Observable<EuProjectStatusStatistics> {
|
||||
return this.httpClient.get<EuProjectStatusStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/eu/status`,
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectStatuses(): Observable<BmbfProjectStatusStatistics> {
|
||||
return this.httpClient.get<BmbfProjectStatusStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/bmbf/status`,
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectCount(): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/bmbf`,
|
||||
|
||||
@@ -129,6 +129,63 @@
|
||||
<p class="statistics-error">Die Kennzahlen konnten nicht geladen werden.</p>
|
||||
}
|
||||
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
(euProjectStatuses && bmbfProjectStatuses)
|
||||
) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Projektstatus nach Fördergeber</h2>
|
||||
<p>
|
||||
Laufende, kommende und abgeschlossene EU- und Bund-Projekte Ihrer Organisation.
|
||||
</p>
|
||||
</div>
|
||||
@if (euProjectStatuses && bmbfProjectStatuses) {
|
||||
<div class="project-status-summary">
|
||||
<span>
|
||||
EU:
|
||||
{{
|
||||
euProjectStatuses.ongoing +
|
||||
euProjectStatuses.upcoming +
|
||||
euProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
Bund:
|
||||
{{
|
||||
bmbfProjectStatuses.ongoing +
|
||||
bmbfProjectStatuses.upcoming +
|
||||
bmbfProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (euProjectStatusesLoading || bmbfProjectStatusesLoading) {
|
||||
<div class="project-status-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Projektstatus wird geladen …"
|
||||
icon="stacked_bar_chart"
|
||||
size="64"
|
||||
diameter="64"></app-loading>
|
||||
</div>
|
||||
} @else if (euProjectStatusesError || bmbfProjectStatusesError) {
|
||||
<p class="statistics-error">
|
||||
Der Status der EU- und Bund-Projekte konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else if (euProjectStatuses && bmbfProjectStatuses) {
|
||||
<app-eu-project-status-chart
|
||||
[statuses]="euProjectStatuses"
|
||||
[bmbfStatuses]="bmbfProjectStatuses"></app-eu-project-status-chart>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (topicHeatmapLoading || topicHeatmapError || hasTopicHeatmapData()) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
|
||||
@@ -144,6 +144,27 @@
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.project-status-loading {
|
||||
min-height: 15rem;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.project-status-summary {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
gap: 0.5rem;
|
||||
|
||||
span {
|
||||
padding: 0.35rem 0.65rem;
|
||||
border-radius: 999px;
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.dfg-topic-summary {
|
||||
flex: 0 0 auto;
|
||||
color: #475569;
|
||||
|
||||
@@ -5,13 +5,16 @@ import { Observable, finalize } from 'rxjs';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { TopicHeatmapComponent } from './topic-heatmap/topic-heatmap.component';
|
||||
import { DfgTopicDonutComponent } from './dfg-topic-donut/dfg-topic-donut.component';
|
||||
import { EuProjectStatusChartComponent } from './eu-project-status-chart/eu-project-status-chart.component';
|
||||
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import {
|
||||
BmbfProjectStatusStatistics,
|
||||
DashboardStatisticValue,
|
||||
DashboardStatistics,
|
||||
DashboardStatisticsService,
|
||||
DfgProjectTopics,
|
||||
EuProjectStatusStatistics,
|
||||
TopAuthor,
|
||||
TopAuthorStatistics,
|
||||
TopAuthorsWorksPeriod,
|
||||
@@ -32,6 +35,7 @@ type DashboardStatisticKey =
|
||||
RouterLink,
|
||||
LoadingComponent,
|
||||
DfgTopicDonutComponent,
|
||||
EuProjectStatusChartComponent,
|
||||
TopicHeatmapComponent,
|
||||
YearRangeSliderComponent,
|
||||
],
|
||||
@@ -69,6 +73,12 @@ export class DashboardComponent implements OnInit {
|
||||
dfgProjectTopics?: DfgProjectTopics;
|
||||
dfgTopicsLoading = false;
|
||||
dfgTopicsError = false;
|
||||
euProjectStatuses?: EuProjectStatusStatistics;
|
||||
euProjectStatusesLoading = false;
|
||||
euProjectStatusesError = false;
|
||||
bmbfProjectStatuses?: BmbfProjectStatusStatistics;
|
||||
bmbfProjectStatusesLoading = false;
|
||||
bmbfProjectStatusesError = false;
|
||||
readonly topicTreemapMinYear = 1900;
|
||||
readonly topicTreemapMaxYear = new Date().getFullYear();
|
||||
topicTreemapFromYear = this.topicTreemapMaxYear - 4;
|
||||
@@ -89,6 +99,8 @@ export class DashboardComponent implements OnInit {
|
||||
this.loadTopAuthors();
|
||||
this.loadTopicHeatmap();
|
||||
this.loadDfgProjectTopics();
|
||||
this.loadEuProjectStatuses();
|
||||
this.loadBmbfProjectStatuses();
|
||||
}
|
||||
|
||||
private loadStatistics(): void {
|
||||
@@ -326,6 +338,38 @@ export class DashboardComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private loadEuProjectStatuses(): void {
|
||||
this.euProjectStatusesLoading = true;
|
||||
this.euProjectStatusesError = false;
|
||||
this.statisticsService
|
||||
.getEuProjectStatuses()
|
||||
.pipe(finalize(() => (this.euProjectStatusesLoading = false)))
|
||||
.subscribe({
|
||||
next: (statuses) => {
|
||||
this.euProjectStatuses = statuses;
|
||||
},
|
||||
error: () => {
|
||||
this.euProjectStatusesError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadBmbfProjectStatuses(): void {
|
||||
this.bmbfProjectStatusesLoading = true;
|
||||
this.bmbfProjectStatusesError = false;
|
||||
this.statisticsService
|
||||
.getBmbfProjectStatuses()
|
||||
.pipe(finalize(() => (this.bmbfProjectStatusesLoading = false)))
|
||||
.subscribe({
|
||||
next: (statuses) => {
|
||||
this.bmbfProjectStatuses = statuses;
|
||||
},
|
||||
error: () => {
|
||||
this.bmbfProjectStatusesError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadTopicHeatmap(): void {
|
||||
if (this.topicTreemapFromYear > this.topicTreemapToYear) {
|
||||
this.topicHeatmapLoading = false;
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<div
|
||||
echarts
|
||||
[options]="options"
|
||||
class="eu-project-status-chart"
|
||||
role="img"
|
||||
aria-label="Gestapeltes Balkendiagramm zum Status der EU- und Bund-Projekte"></div>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
.eu-project-status-chart {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import {
|
||||
BmbfProjectStatusStatistics,
|
||||
EuProjectStatusStatistics,
|
||||
} from '../dashboard-statistics.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eu-project-status-chart',
|
||||
imports: [NgxEchartsDirective],
|
||||
templateUrl: './eu-project-status-chart.component.html',
|
||||
styleUrl: './eu-project-status-chart.component.scss',
|
||||
})
|
||||
export class EuProjectStatusChartComponent implements OnChanges {
|
||||
@Input({ required: true }) statuses!: EuProjectStatusStatistics;
|
||||
@Input({ required: true }) bmbfStatuses!: BmbfProjectStatusStatistics;
|
||||
|
||||
options: EChartsOption = {};
|
||||
|
||||
ngOnChanges(): void {
|
||||
const values = [
|
||||
{
|
||||
name: 'Laufend',
|
||||
data: [
|
||||
this.statuses?.ongoing ?? 0,
|
||||
this.bmbfStatuses?.ongoing ?? 0,
|
||||
],
|
||||
color: '#2563eb',
|
||||
},
|
||||
{
|
||||
name: 'Kommend',
|
||||
data: [
|
||||
this.statuses?.upcoming ?? 0,
|
||||
this.bmbfStatuses?.upcoming ?? 0,
|
||||
],
|
||||
color: '#f59e0b',
|
||||
},
|
||||
{
|
||||
name: 'Abgeschlossen',
|
||||
data: [
|
||||
this.statuses?.completed ?? 0,
|
||||
this.bmbfStatuses?.completed ?? 0,
|
||||
],
|
||||
color: '#64748b',
|
||||
},
|
||||
];
|
||||
|
||||
this.options = {
|
||||
color: values.map((item) => item.color),
|
||||
animationDuration: 500,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'shadow' },
|
||||
confine: true,
|
||||
valueFormatter: (value) =>
|
||||
`${Number(value ?? 0).toLocaleString('de-DE')} Projekte`,
|
||||
},
|
||||
legend: {
|
||||
top: 0,
|
||||
left: 'center',
|
||||
data: values.map((item) => item.name),
|
||||
textStyle: { color: '#334155' },
|
||||
},
|
||||
grid: { top: 56, right: 24, bottom: 30, left: 24, containLabel: true },
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
minInterval: 1,
|
||||
name: 'Anzahl Projekte',
|
||||
nameLocation: 'middle',
|
||||
nameGap: 28,
|
||||
axisLabel: { color: '#64748b' },
|
||||
splitLine: { lineStyle: { color: '#e2e8f0' } },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: ['EU-Projekte', 'Bund-Projekte'],
|
||||
axisTick: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisLabel: { color: '#334155', fontWeight: 600 },
|
||||
},
|
||||
series: values.map((item, index) => ({
|
||||
name: item.name,
|
||||
type: 'bar',
|
||||
stack: 'status',
|
||||
barWidth: 54,
|
||||
data: item.data,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
formatter: (params) =>
|
||||
Number(params.value ?? 0) > 0 ? String(params.value) : '',
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
},
|
||||
itemStyle: {
|
||||
borderRadius:
|
||||
index === 0
|
||||
? [6, 0, 0, 6]
|
||||
: index === values.length - 1
|
||||
? [0, 6, 6, 0]
|
||||
: 0,
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user