fix(chart): превью в гостевом режиме, контрастнее цвета и толще линии графиков

This commit is contained in:
Иван Овчинников
2026-11-20 07:38:12 +03:00
parent baa0f57536
commit e77aa6df17
5 changed files with 34 additions and 25 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ export function showChartDialog(exerciseName, clientId = null) {
// Вершины: крупная точка + подпись «вес×повт.» с цветом прогресса
const showLabel = i => n <= 10 || i >= n - 5 || classes[i] !== 'chart-flat';
const verts = points.map((p, i) =>
`<circle class="chart-vert ${classes[i]}" cx="${x(i).toFixed(1)}" cy="${y(dayTop(p)).toFixed(1)}" r="4"></circle>` +
`<circle class="chart-vert ${classes[i]}" cx="${x(i).toFixed(1)}" cy="${y(dayTop(p)).toFixed(1)}" r="5.5"></circle>` +
(showLabel(i)
? `<text x="${x(i).toFixed(1)}" y="${(y(dayTop(p)) - 8).toFixed(1)}" text-anchor="middle" class="chart-label chart-vert-label ${classes[i]}">${topLabel(p)}</text>`
: '')
+8 -8
View File
@@ -41,7 +41,7 @@ export function drawExerciseProgress(canvas, exerciseName) {
// Прогресс вершины относительно прошлой тренировки: вес выше — или тот же
// вес и больше повторов => зелёный; меньше => красный; ровно => фиолетовый.
const COLORS = { up: '#4caf50', down: '#e57373', flat: '#bb86fc' };
const COLORS = { up: '#3ddc55', down: '#ff5a5a', flat: '#c792ff' };
const cls = i => {
if (i === 0) return 'flat';
const a = days[i - 1], b = days[i];
@@ -56,7 +56,7 @@ export function drawExerciseProgress(canvas, exerciseName) {
// Линия рабочего максимума: отрезки окрашены по прогрессу конца отрезка
for (let i = 1; i < n; i++) {
ctx.strokeStyle = COLORS[classes[i]];
ctx.lineWidth = 2.5;
ctx.lineWidth = 4;
ctx.beginPath();
ctx.moveTo(x(i - 1), y(days[i - 1].max));
ctx.lineTo(x(i), y(days[i].max));
@@ -71,9 +71,9 @@ export function drawExerciseProgress(canvas, exerciseName) {
const spread = below.length > 1 ? Math.min(11, chartW / (3 * n)) : 0;
below.forEach((s, k) => {
const dx = below.length > 1 ? -spread + (2 * spread * k) / (below.length - 1) : 0;
const r = 1.8 + 2.4 * Math.min(1, s.reps / maxReps);
const r = 2.2 + 2.8 * Math.min(1, s.reps / maxReps);
ctx.beginPath();
ctx.fillStyle = 'rgba(187, 134, 252, 0.35)';
ctx.fillStyle = 'rgba(199, 146, 255, 0.55)';
ctx.arc(px + dx, y(s.weight), r, 0, Math.PI * 2);
ctx.fill();
});
@@ -81,14 +81,14 @@ export function drawExerciseProgress(canvas, exerciseName) {
// Вершина: рабочий максимум «вес × повторы» с цветом прогресса
ctx.beginPath();
ctx.fillStyle = COLORS[classes[i]];
ctx.arc(px, y(d.max), 4.2, 0, Math.PI * 2);
ctx.arc(px, y(d.max), 5.5, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = '#ffffff';
ctx.lineWidth = 1.2;
ctx.stroke();
if (n <= 10 || i >= n - 4 || classes[i] !== 'flat') {
ctx.fillStyle = COLORS[classes[i]];
ctx.font = 'bold 10px sans-serif';
ctx.font = 'bold 11px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(`${d.max}×${d.topReps || ''}`, px, y(d.max) - 7);
}
@@ -113,8 +113,8 @@ export function drawExerciseProgress(canvas, exerciseName) {
}
drawLegend(ctx, width, [
{ color: '#4caf50', label: 'рабочий максимум: зелёный — прогресс, красный — откат' },
{ color: 'rgba(187, 134, 252, 0.45)', label: 'тусклая точка = подход (размер = повторы)' },
{ color: '#3ddc55', label: 'рабочий максимум: зелёный — прогресс, красный — откат' },
{ color: 'rgba(199, 146, 255, 0.55)', label: 'тусклая точка = подход (размер = повторы)' },
]);
}