fitness: disable chart grow-in animation, add trendlines to exercise charts

Disable initial animation on all Chart.js charts (FitnessChart and
cospend BarChart) while keeping transition animations for interactions.
Add linear regression trendline with ±1σ uncertainty bands to exercise
charts (Est. 1RM, Max Weight, Total Volume).
This commit is contained in:
2026-03-20 13:43:58 +01:00
parent d1527b2572
commit 3778f53115
3 changed files with 114 additions and 8 deletions
@@ -107,6 +107,7 @@
options: {
responsive: true,
maintainAspectRatio: false,
animation: { duration: 0 },
layout: {
padding: {
top: 40
@@ -322,6 +323,15 @@
onMount(() => {
createChart();
// Enable animations for subsequent updates (legend toggles, etc.)
requestAnimationFrame(() => {
if (chart) {
chart.options.animation = { duration: 300 };
chart.options.transitions = {
active: { animation: { duration: 200 } }
};
}
});
// Watch for theme changes (both media query and data-theme attribute)
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
@@ -69,7 +69,7 @@
options: {
responsive: true,
maintainAspectRatio: false,
animation: false,
animation: { duration: 0 },
scales: {
x: {
grid: { display: false },
@@ -120,6 +120,14 @@
onMount(() => {
createChart();
requestAnimationFrame(() => {
if (chart) {
chart.options.animation = { duration: 300 };
chart.options.transitions = {
active: { animation: { duration: 200 } }
};
}
});
const mq = window.matchMedia('(prefers-color-scheme: dark)');
const onTheme = () => setTimeout(createChart, 100);