Update SVG dimensions and adjust layout for dashboard charts

This commit is contained in:
Matt Batchelder
2026-02-21 02:29:38 -05:00
parent 954c418556
commit 4591578cb2
2 changed files with 62 additions and 60 deletions

View File

@@ -10,6 +10,8 @@
var BAR_H = 120; // max bar height (SVG units)
var BAR_MIN = 0.15; // min bar ratio
var LINE_PTS = 8;
var LINE_W = 340; // line graph width in SVG units
var PIE_R = 55; // pie chart radius
var DARK = { text: '#E0E0E0', muted: '#9E9E9E', border: '#333', center: '#222' };
var LIGHT = { text: '#333333', muted: '#666666', border: '#E0E0E0', center: '#fff' };
@@ -58,12 +60,12 @@
if (!st.linePath) return;
var d = 'M';
for (var i = 0; i < LINE_PTS; i++) {
var x = (i / (LINE_PTS - 1)) * 200;
var x = (i / (LINE_PTS - 1)) * LINE_W;
var y = 25 + (1 - wave(st.phase * 0.8, i * 0.9)) * 110;
d += (i ? ' L' : '') + x.toFixed(1) + ',' + y.toFixed(1);
}
st.linePath.setAttribute('d', d);
if (st.lineFill) st.lineFill.setAttribute('d', d + ' L200,145 L0,145 Z');
if (st.lineFill) st.lineFill.setAttribute('d', d + ' L' + LINE_W + ',145 L0,145 Z');
}
/* Pie: each segment gently shifts its slice size, no spinning */
@@ -85,7 +87,7 @@
var endA = (angle + sweep) * Math.PI / 180;
// Large-arc flag needed when sweep > 180
var large = sweep > 180 ? 1 : 0;
var r = 45;
var r = PIE_R;
var x1 = Math.sin(startA) * r, y1 = -Math.cos(startA) * r;
var x2 = Math.sin(endA) * r, y2 = -Math.cos(endA) * r;
var path = st.pieSegs[j].querySelector('path');