From 5a251d182a170a93adfa7806a321c6352aa60f23 Mon Sep 17 00:00:00 2001 From: ACX <8075870+acx10@users.noreply.github.com> Date: Thu, 1 Jan 2026 20:06:07 -0700 Subject: [PATCH] Fix inconsistent spacing and label display in reading heatmap chart (#2099) Co-authored-by: acx10 --- .../reading-heatmap-chart.component.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/booklore-ui/src/app/features/stats/component/reading-heatmap-chart/reading-heatmap-chart.component.ts b/booklore-ui/src/app/features/stats/component/reading-heatmap-chart/reading-heatmap-chart.component.ts index 41b483c82..54e05cec1 100644 --- a/booklore-ui/src/app/features/stats/component/reading-heatmap-chart/reading-heatmap-chart.component.ts +++ b/booklore-ui/src/app/features/stats/component/reading-heatmap-chart/reading-heatmap-chart.component.ts @@ -44,7 +44,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy { maintainAspectRatio: false, layout: { padding: { - top: 30 + top: 20 } }, plugins: { @@ -102,6 +102,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy { }, y: { type: 'linear', + offset: true, ticks: { stepSize: 1, callback: (value) => this.yearLabels[value as number] || '', @@ -150,7 +151,6 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy { private updateChartData(yearMonthData: YearMonthData[]): void { const currentYear = new Date().getFullYear(); - const currentMonth = new Date().getMonth(); const years = Array.from({length: 10}, (_, i) => currentYear - 9 + i); this.yearLabels = years.map(String); @@ -159,9 +159,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy { const heatmapData: MatrixDataPoint[] = []; years.forEach((year, yearIndex) => { - const maxMonth = year === currentYear ? currentMonth : 11; - - for (let month = 0; month <= maxMonth; month++) { + for (let month = 0; month <= 11; month++) { const dataPoint = yearMonthData.find(d => d.year === year && d.month === month + 1); heatmapData.push({ x: month, @@ -172,7 +170,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy { }); if (this.chartOptions?.scales?.['y']) { - (this.chartOptions.scales['y'] as any).max = years.length - 0.5; + (this.chartOptions.scales['y'] as any).max = years.length - 1; } this.chartDataSubject.next({