// Lightweight inline SVG charts for the TechyFuel OS kit (data viz, not icons).
function AreaLine({ data, width = 520, height = 160, color = 'var(--blue-600)', fill = 'rgba(37,99,235,0.10)', id = 'al' }) {
const max = Math.max(...data) * 1.15, min = Math.min(...data) * 0.85;
const pad = 6;
const x = i => pad + (i * (width - pad * 2)) / (data.length - 1);
const y = v => height - pad - ((v - min) / (max - min)) * (height - pad * 2);
const pts = data.map((v, i) => [x(i), y(v)]);
const line = pts.map((p, i) => `${i ? 'L' : 'M'}${p[0].toFixed(1)} ${p[1].toFixed(1)}`).join(' ');
const area = `${line} L${x(data.length - 1)} ${height - pad} L${x(0)} ${height - pad} Z`;
return (
);
}
function Bars({ data, labels, width = 520, height = 160, color = 'var(--blue-500)', highlight = 'var(--blue-600)' }) {
const max = Math.max(...data) * 1.1 || 1, pad = 6, gap = 10;
const bw = (width - pad * 2 - gap * (data.length - 1)) / data.length;
return (
);
}
function Donut({ segments, size = 150, thickness = 22 }) {
const total = segments.reduce((s, x) => s + x.value, 0);
const r = (size - thickness) / 2, c = 2 * Math.PI * r;
let offset = 0;
return (
);
}
function Spark({ data, width = 100, height = 32, color = 'var(--green-500)' }) {
const max = Math.max(...data), min = Math.min(...data);
const x = i => (i * width) / (data.length - 1);
const y = v => height - ((v - min) / (max - min || 1)) * height;
const line = data.map((v, i) => `${i ? 'L' : 'M'}${x(i).toFixed(1)} ${y(v).toFixed(1)}`).join(' ');
return ;
}
Object.assign(window, { AreaLine, Bars, Donut, Spark });