diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.html b/webapp/src/app/modules/compare-authors/compare-authors.component.html
index b8942c1c..3c444350 100644
--- a/webapp/src/app/modules/compare-authors/compare-authors.component.html
+++ b/webapp/src/app/modules/compare-authors/compare-authors.component.html
@@ -1,71 +1,138 @@
-
Autoren-Vergleich
+
@if (loading()) {
Lädt…
- } @else if (data().length === 0) {
+ } @else if (!hasData()) {
Keine Daten für die ausgewählten Autoren.
} @else {
-
-
-
-
-
- }
+
+
+ Kennzahlen im Vergleich
+
+ Bester Wert je Zeile ist hervorgehoben. „–“ bedeutet, dass der Wert für
+ diese:n Autor:in nicht vorliegt.
+
- @if (corresponding().length > 0) {
-
-
- Corresponding-Author-Werke
-
-
-
- }
+
+
- @if (impact().length > 0) {
-
-
- Ø Impact-Perzentil (0–1)
-
-
-
+
+
-
-
- Top-10%-Works
+
+
+
+ Werke gesamt (Thema)
-
-
+ class="chart-container chart-container--sm">
+
-
-
- Top-1%-Works
+
+ Corresponding-Author-Werke
-
-
+ class="chart-container chart-container--sm">
+
+
+
+ Ø Impact-Perzentil (0–1)
+
+
+
+
+ Hoch zitierte Werke
+
+
+
}
diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.scss b/webapp/src/app/modules/compare-authors/compare-authors.component.scss
index 487d078e..e7f077f7 100644
--- a/webapp/src/app/modules/compare-authors/compare-authors.component.scss
+++ b/webapp/src/app/modules/compare-authors/compare-authors.component.scss
@@ -1,28 +1,203 @@
.compare-layout {
- padding: 1rem;
+ padding: 28px 32px 42px;
+ display: flex;
+ flex-direction: column;
+ gap: 18px;
+ max-width: 1280px;
+ margin: 0 auto;
+ box-sizing: border-box;
}
-.compare-keywords {
- color: var(--sg-text-secondary, rgba(0, 0, 0, 0.6));
- margin-bottom: 1rem;
+/* ---- header ---- */
+.compare-header {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+
+ h1 {
+ margin: 0;
+ font-size: 24px;
+ font-weight: 700;
+ color: var(--sg-text, #101a3d);
+ }
+}
+
+.compare-meta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+}
+
+.meta-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 4px 12px;
+ border-radius: 999px;
+ background: var(--sg-surface-muted, #f7f9ff);
+ border: 1px solid var(--sg-border, #dde5f2);
+ color: var(--sg-text-muted, #64708f);
+ font-size: 13px;
+
+ mat-icon {
+ font-size: 16px;
+ width: 16px;
+ height: 16px;
+ color: var(--sg-text-soft, #8a95b3);
+ }
+}
+
+.author-legend {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px 18px;
+}
+
+.legend-item {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--sg-text, #101a3d);
+}
+
+.legend-swatch {
+ width: 12px;
+ height: 12px;
+ border-radius: 3px;
+ flex: 0 0 auto;
+}
+
+/* ---- cards ---- */
+.card {
+ background: #fff;
+ border: 1px solid #d7e4ff;
+ border-radius: 16px;
+ box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
+ padding: 20px 22px;
+}
+
+.card-title {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 700;
+ color: var(--sg-text, #101a3d);
+}
+
+.card-sub {
+ margin: 4px 0 0;
+ font-size: 13px;
+ color: var(--sg-text-muted, #64708f);
}
.compare-hint {
- padding: 0.5rem 0.25rem;
+ padding: 24px;
+ text-align: center;
+ color: var(--sg-text-muted, #64708f);
}
-/* echarts needs an explicit height or it won't render */
+/* ---- comparison table ---- */
+.table-scroll {
+ margin-top: 14px;
+ overflow-x: auto;
+}
+
+.compare-table {
+ width: 100%;
+ border-collapse: collapse;
+ font-size: 14px;
+
+ thead th {
+ text-align: left;
+ padding: 0 16px 10px;
+ border-bottom: 2px solid var(--sg-border, #dde5f2);
+ vertical-align: bottom;
+ }
+
+ .author-col {
+ text-align: right;
+ }
+
+ .th-name {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ font-weight: 700;
+ color: var(--sg-text, #101a3d);
+ }
+
+ tbody tr + tr th,
+ tbody tr + tr td {
+ border-top: 1px solid var(--sg-border, #dde5f2);
+ }
+
+ tbody th,
+ tbody td {
+ padding: 12px 16px;
+ }
+}
+
+.metric-col {
+ min-width: 220px;
+}
+
+.metric-label {
+ display: block;
+ font-weight: 600;
+ color: var(--sg-text, #101a3d);
+}
+
+.metric-hint {
+ display: block;
+ margin-top: 2px;
+ font-size: 12px;
+ font-weight: 400;
+ color: var(--sg-text-soft, #8a95b3);
+}
+
+.value-cell {
+ text-align: right;
+ font-variant-numeric: tabular-nums;
+ color: var(--sg-text, #101a3d);
+ white-space: nowrap;
+
+ &.best {
+ font-weight: 700;
+ color: var(--sg-primary, #0b1020);
+ background: var(--sg-surface-soft, #f3f6fd);
+ }
+}
+
+.value-empty {
+ color: var(--sg-text-soft, #8a95b3);
+}
+
+/* ---- charts ---- */
.chart-container {
- height: 500px;
+ height: 420px;
width: 100%;
}
-.chart-title {
- margin: 0 0 0.5rem;
- font-size: 1rem;
- font-weight: 500;
+.chart-container--sm {
+ height: 300px;
}
-mat-card {
- margin-bottom: 1rem;
+.chart-grid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 18px;
+}
+
+@media (max-width: 900px) {
+ .compare-layout {
+ padding: 20px 16px 32px;
+ }
+
+ .chart-grid {
+ grid-template-columns: 1fr;
+ }
}
diff --git a/webapp/src/app/modules/compare-authors/compare-authors.component.ts b/webapp/src/app/modules/compare-authors/compare-authors.component.ts
index 4bf39280..b7d2984e 100644
--- a/webapp/src/app/modules/compare-authors/compare-authors.component.ts
+++ b/webapp/src/app/modules/compare-authors/compare-authors.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit, computed, inject, signal } from '@angular/core';
+import { DecimalPipe } from '@angular/common';
import { ActivatedRoute } from '@angular/router';
-import { MatCardModule } from '@angular/material/card';
+import { MatIconModule } from '@angular/material/icon';
import { EChartsOption } from 'echarts';
import { NgxEchartsDirective } from 'ngx-echarts';
@@ -11,12 +12,53 @@ import {
RankingService,
} from '../../api';
-const LINE_COLORS = ['#1565c0', '#e6550d', '#2ca02c', '#9467bd'];
+const AUTHOR_COLORS = ['#1565c0', '#e6550d', '#2ca02c', '#9467bd'];
+
+const AXIS_LABEL = { color: '#4b5563', fontFamily: 'Open Sans' };
+const AXIS_LINE = { lineStyle: { color: '#e5e7eb' } };
+const SPLIT_LINE = { lineStyle: { color: '#f3f4f6' } };
+const TOOLTIP = {
+ backgroundColor: 'rgba(255,255,255,0.98)',
+ borderColor: '#e5e7eb',
+ borderWidth: 1,
+ textStyle: { color: '#374151', fontFamily: 'Open Sans' },
+ extraCssText: 'border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,0.15);',
+};
+const BAR_LABEL = {
+ show: true,
+ position: 'top' as const,
+ color: '#374151',
+ fontFamily: 'Open Sans',
+ fontWeight: 600,
+};
+
+interface AuthorSummary {
+ authorId: string;
+ name: string;
+ color: string;
+ totalWorks: number;
+ corresponding: number | null;
+ avgPercentile: number | null;
+ top10: number | null;
+ top1: number | null;
+}
+
+interface MetricCell {
+ raw: number | null;
+ best: boolean;
+}
+
+interface MetricRow {
+ label: string;
+ hint: string;
+ decimals: boolean;
+ cells: MetricCell[];
+}
@Component({
selector: 'app-compare-authors',
standalone: true,
- imports: [MatCardModule, NgxEchartsDirective],
+ imports: [DecimalPipe, MatIconModule, NgxEchartsDirective],
templateUrl: './compare-authors.component.html',
styleUrl: './compare-authors.component.scss',
})
@@ -25,134 +67,249 @@ export class CompareAuthorsComponent implements OnInit {
private readonly rankingService = inject(RankingService);
readonly keywords = signal([]);
+ readonly timespan = signal<{ from: number; to: number } | null>(null);
+ // full OpenAlex ids in the requested order — the source of truth for colour + order
+ readonly authorIds = signal([]);
+
readonly data = signal([]);
readonly corresponding = signal([]);
readonly impact = signal([]);
readonly loading = signal(false);
+ // merges the three endpoints into one row per author, in the requested order
+ readonly summary = computed(() => {
+ const yearly = new Map(this.data().map((a) => [a.author_id, a]));
+ const corr = new Map(this.corresponding().map((a) => [a.author_id, a]));
+ const imp = new Map(this.impact().map((a) => [a.author_id, a]));
+
+ return this.authorIds().map((id, index) => {
+ const y = yearly.get(id);
+ const c = corr.get(id);
+ const im = imp.get(id);
+ const name =
+ y?.display_name ??
+ c?.display_name ??
+ im?.display_name ??
+ id.split('/').pop() ??
+ id;
+
+ return {
+ authorId: id,
+ name,
+ color: AUTHOR_COLORS[index % AUTHOR_COLORS.length],
+ totalWorks: y ? y.years.reduce((sum, e) => sum + e.count, 0) : 0,
+ corresponding: c ? c.value : null,
+ avgPercentile: im ? im.avg_percentile : null,
+ top10: im ? im.top10_count : null,
+ top1: im ? im.top1_count : null,
+ };
+ });
+ });
+
+ readonly hasData = computed(() => this.summary().length > 0);
+
+ // the comparison table: every scalar value the backend returns, best per row marked
+ readonly metricRows = computed(() => {
+ const authors = this.summary();
+
+ const row = (
+ label: string,
+ hint: string,
+ select: (a: AuthorSummary) => number | null,
+ decimals = false,
+ ): MetricRow => {
+ const values = authors.map(select);
+ const present = values.filter((v): v is number => v !== null);
+ const max = present.length ? Math.max(...present) : null;
+ return {
+ label,
+ hint,
+ decimals,
+ cells: values.map((raw) => ({
+ raw,
+ best: raw !== null && max !== null && raw === max && max > 0,
+ })),
+ };
+ };
+
+ return [
+ row(
+ 'Werke gesamt',
+ 'Publikationen zum Thema im Zeitraum',
+ (a) => a.totalWorks,
+ ),
+ row(
+ 'Corresponding-Author-Werke',
+ 'Werke, in denen die Person korrespondierende:r Autor:in ist',
+ (a) => a.corresponding,
+ ),
+ row(
+ 'Ø Impact-Perzentil',
+ 'Feld-normalisiertes Zitations-Perzentil (0–1)',
+ (a) => a.avgPercentile,
+ true,
+ ),
+ row(
+ 'Top-10%-Werke',
+ 'Werke unter den 10% meistzitierten',
+ (a) => a.top10,
+ ),
+ row('Top-1%-Werke', 'Werke unter den 1% meistzitierten', (a) => a.top1),
+ ];
+ });
+
+ // line chart: works per year, one line per author
readonly chartOption = computed(() => {
- const authors = this.data();
+ const authors = this.summary();
+ const yearly = new Map(this.data().map((a) => [a.author_id, a]));
if (authors.length === 0) {
return {};
}
- // shared, ascending list of every year that appears for any author
const yearSet = new Set();
- for (const author of authors) {
+ for (const author of this.data()) {
for (const entry of author.years) {
yearSet.add(entry.year);
}
}
const years = Array.from(yearSet).sort((a, b) => a - b);
- const series = authors.map((author, index) => {
+ const series = authors.map((author) => {
+ const source = yearly.get(author.authorId);
const countByYear = new Map();
- for (const entry of author.years) {
+ for (const entry of source?.years ?? []) {
countByYear.set(entry.year, entry.count);
}
-
- const color = LINE_COLORS[index % LINE_COLORS.length];
return {
- name: author.display_name,
+ name: author.name,
type: 'line',
smooth: true,
+ symbolSize: 8,
emphasis: { focus: 'series' },
- lineStyle: { color },
- itemStyle: { color },
- // align every author to the shared year axis, filling gaps with 0
+ lineStyle: { color: author.color, width: 2.5 },
+ itemStyle: { color: author.color },
data: years.map((year) => countByYear.get(year) ?? 0),
};
});
return {
- tooltip: { trigger: 'axis' },
- legend: { bottom: 0, type: 'scroll' },
- grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
- xAxis: { type: 'category', boundaryGap: false, data: years.map(String) },
- yAxis: { type: 'value', name: 'Werke' },
+ color: authors.map((a) => a.color),
+ tooltip: { trigger: 'axis', ...TOOLTIP },
+ grid: { left: '3%', right: '4%', top: 16, bottom: 8, containLabel: true },
+ xAxis: {
+ type: 'category',
+ boundaryGap: false,
+ data: years.map(String),
+ axisLabel: AXIS_LABEL,
+ axisLine: AXIS_LINE,
+ axisTick: { show: false },
+ },
+ yAxis: {
+ type: 'value',
+ name: 'Werke',
+ nameTextStyle: AXIS_LABEL,
+ axisLabel: AXIS_LABEL,
+ splitLine: SPLIT_LINE,
+ },
series: series as unknown as EChartsOption['series'],
};
});
- // bar chart: works where the author is the corresponding author, per selected author
- readonly barChartOption = computed(() => {
- const authors = this.corresponding();
+ readonly totalWorksOption = computed(() =>
+ this.singleMetricBar((a) => a.totalWorks),
+ );
+ readonly correspondingOption = computed(() =>
+ this.singleMetricBar((a) => a.corresponding),
+ );
+ readonly percentileOption = computed(() =>
+ this.singleMetricBar((a) => a.avgPercentile, { max: 1, decimals: true }),
+ );
+
+ // grouped bars: top-10% vs top-1% works, one coloured bar per author in each group
+ readonly topCitedOption = computed(() => {
+ const authors = this.summary();
if (authors.length === 0) {
return {};
}
- const bars = authors.map((author, index) => ({
- value: author.value,
- itemStyle: { color: LINE_COLORS[index % LINE_COLORS.length] },
+ const series = authors.map((author) => ({
+ name: author.name,
+ type: 'bar',
+ itemStyle: { color: author.color, borderRadius: [4, 4, 0, 0] },
+ label: BAR_LABEL,
+ data: [author.top10 ?? 0, author.top1 ?? 0],
}));
return {
- tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
- grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
+ color: authors.map((a) => a.color),
+ tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' }, ...TOOLTIP },
+ grid: { left: '3%', right: '4%', top: 24, bottom: 8, containLabel: true },
xAxis: {
type: 'category',
- data: authors.map((author) => author.display_name),
- axisLabel: { interval: 0, rotate: 30 },
+ data: ['Top 10%', 'Top 1%'],
+ axisLabel: AXIS_LABEL,
+ axisLine: AXIS_LINE,
+ axisTick: { show: false },
},
- yAxis: { type: 'value', name: 'Corresponding Works' },
- series: [
- { type: 'bar', data: bars },
- ] as unknown as EChartsOption['series'],
+ yAxis: {
+ type: 'value',
+ axisLabel: AXIS_LABEL,
+ splitLine: SPLIT_LINE,
+ },
+ series: series as unknown as EChartsOption['series'],
};
});
- // citation-impact bar charts (one value each), per selected author
- readonly avgPercentileOption = computed(() =>
- this.buildImpactBar(
- this.impact(),
- (author) => author.avg_percentile,
- 'Ø Perzentil',
- ),
- );
- readonly top10Option = computed(() =>
- this.buildImpactBar(
- this.impact(),
- (author) => author.top10_count,
- 'Top-10%-Works',
- ),
- );
- readonly top1Option = computed(() =>
- this.buildImpactBar(
- this.impact(),
- (author) => author.top1_count,
- 'Top-1%-Works',
- ),
- );
-
- private buildImpactBar(
- authors: AuthorImpactStats[],
- valueFn: (author: AuthorImpactStats) => number,
- yName: string,
+ private singleMetricBar(
+ select: (a: AuthorSummary) => number | null,
+ opts: { max?: number; decimals?: boolean } = {},
): EChartsOption {
+ const authors = this.summary();
if (authors.length === 0) {
return {};
}
- const bars = authors.map((author, index) => ({
- value: valueFn(author),
- itemStyle: { color: LINE_COLORS[index % LINE_COLORS.length] },
+ const bars = authors.map((author) => ({
+ value: select(author) ?? 0,
+ itemStyle: { color: author.color, borderRadius: [4, 4, 0, 0] },
}));
return {
- tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
- grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
+ tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' }, ...TOOLTIP },
+ grid: { left: '3%', right: '4%', top: 24, bottom: 8, containLabel: true },
xAxis: {
type: 'category',
- data: authors.map((author) => author.display_name),
- axisLabel: { interval: 0, rotate: 30 },
+ data: authors.map((a) => this.truncate(a.name)),
+ axisLabel: { ...AXIS_LABEL, interval: 0, hideOverlap: true },
+ axisLine: AXIS_LINE,
+ axisTick: { show: false },
+ },
+ yAxis: {
+ type: 'value',
+ max: opts.max,
+ axisLabel: AXIS_LABEL,
+ splitLine: SPLIT_LINE,
},
- yAxis: { type: 'value', name: yName },
series: [
- { type: 'bar', data: bars },
+ {
+ type: 'bar',
+ barMaxWidth: 72,
+ data: bars,
+ label: {
+ ...BAR_LABEL,
+ formatter: opts.decimals
+ ? (p: { value: number }) => p.value.toFixed(2)
+ : undefined,
+ },
+ },
] as unknown as EChartsOption['series'],
};
}
+ private truncate(name: string): string {
+ return name.length > 18 ? `${name.slice(0, 17)}…` : name;
+ }
+
ngOnInit(): void {
// everything is read from the URL so a shared link lands on the same view
const rawAuthors = this.route.snapshot.queryParamMap.get('authors') ?? '';
@@ -174,9 +331,11 @@ export class CompareAuthorsComponent implements OnInit {
: undefined;
const timespan =
rawTFrom && rawTTo ? { from: +rawTFrom, to: +rawTTo } : undefined;
+ this.timespan.set(timespan ?? null);
// ids in the url are bare (A5036...); the endpoint expects full OpenAlex urls
const fullIds = authorIds.map((id) => `https://openalex.org/${id}`);
+ this.authorIds.set(fullIds);
const requestPayload = {
author_ids: fullIds,