import { h } from '/static/admin2/vendor/preact.module.js'; import htm from '/static/admin2/vendor/htm.module.js'; const html = htm.bind(h); // SVG-атрибуты, не style: CSP v2 запрещает inline-стили. export const Bars = ({ values, label, labels = [] }) => { const max = Math.max(1, ...values.map((v) => Math.max(0, v))); const w = 12, gap = 6, h0 = 90; const total = Math.max(1, values.length) * (w + gap); return html`
${label}
${values.map((v, i) => html``)} ${labels.map((m, i) => html`${String(m).slice(5)}`)}
`; }; export const Line = ({ values, label }) => { const max = Math.max(1, ...values.map((v) => Math.max(0, v))); const pts = values.map((v, i) => `${i * 20},${90 - Math.max(0, v) / max * 80}`).join(' '); return html`
${label}
${values.length > 1 ? html`` : html``}
`; };