redesign: IBM Carbon style — Plex fonts, brutal cards, tab navigation

This commit is contained in:
neo committed 2026-06-21 00:24:38 +05:00
1 parent d7ce367e75
commit f69b730169
1 file changed
+487 -300
+487 -300
View File
@@ -3,224 +3,300 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ROI24 — Интерактивный дашборд</title>
<title>ROI24 — Аналитическая панель</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:400,500,600,700&family=IBM+Plex+Mono:400,500,600&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #09090b;
--card: #111113;
--border: rgba(255,255,255,0.06);
--border-h: rgba(255,255,255,0.1);
--text: #fafafa;
--sec: #a1a1aa;
--muted: #52525b;
--g: #22c55e; --gd: rgba(34,197,94,0.12);
--b: #3b82f6; --bd: rgba(59,130,246,0.12);
--a: #f59e0b; --ad: rgba(245,158,11,0.12);
--r: #ef4444; --rd: rgba(239,68,68,0.12);
--p: #a855f7; --pd: rgba(168,85,247,0.12);
--c: #06b6d4; --cd: rgba(6,182,212,0.12);
--mono: 'JetBrains Mono', monospace;
--ease: cubic-bezier(0.4, 0, 0.2, 1);
/* IBM Carbon Design System — Dark 10 */
--bg: #0a0a0a;
--surface: #161616;
--surface-hover: #1f1f1f;
--border: #262626;
--border-strong: #393939;
--text-primary: #f4f4f4;
--text-secondary: #a6a6a6;
--text-tertiary: #6f6f6f;
--accent: #0f6fff;
--accent-hover: #3d8eff;
--accent-dim: rgba(15,111,255,0.1);
--green: #16a34a;
--green-dim: rgba(22,163,74,0.12);
--red: #e21d1d;
--red-dim: rgba(226,29,29,0.12);
--yellow: #eac518;
--yellow-dim: rgba(234,197,24,0.12);
--mono: 'IBM Plex Mono', monospace;
--sans: 'IBM Plex Sans', -apple-system, sans-serif;
--ease-out: cubic-bezier(0.2, 0, 0, 1);
--ease-standard: cubic-bezier(0.2, 0, 0, 1);
}
html { font-size: 14px; }
body {
font-family: 'Inter', -apple-system, sans-serif;
background: var(--bg); color: var(--text);
line-height: 1.6; -webkit-font-smoothing: antialiased;
min-height: 100vh; overflow-x: hidden;
font-family: var(--sans);
background: var(--bg);
color: var(--text-primary);
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
/* ============================================
HEADER
TOP BAR — IBM style
============================================ */
.header {
.topbar {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 28px;
background: rgba(17,17,19,0.85); backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
padding: 0 32px; height: 48px;
background: var(--surface);
border-bottom: 1px solid var(--border);
position: sticky; top: 0; z-index: 100;
}
.logo {
font-family: var(--mono); font-weight: 700; font-size: 15px;
letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px;
.topbar-brand {
font-family: var(--mono); font-size: 13px; font-weight: 600;
letter-spacing: 0.5px; color: var(--text-primary);
display: flex; align-items: center; gap: 10px;
}
.dot {
width: 8px; height: 8px; background: var(--g); border-radius: 50%;
box-shadow: 0 0 8px rgba(34,197,94,0.4);
animation: pulse 2s ease-in-out infinite;
.topbar-brand .icon {
width: 20px; height: 20px; background: var(--accent);
display: flex; align-items: center; justify-content: center;
font-size: 11px; font-weight: 700; color: #fff;
}
@keyframes pulse {
0%,100%{box-shadow:0 0 8px rgba(34,197,94,0.4);}
50%{box-shadow:0 0 16px rgba(34,197,94,0.15);}
}
.hdr-right { display:flex; align-items:center; gap:16px; font-size:12px; }
.live { display:flex; align-items:center; gap:6px; color:var(--g); font-weight:600; }
.live .dot { width:6px; height:6px; }
.clock { font-family:var(--mono); color:var(--muted); font-size:11px; }
.topbar-right { display: flex; align-items: center; gap: 20px; font-size: 12px; }
.status { display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 500; }
.status-dot { width: 6px; height: 6px; background: var(--green); border-radius: 0; animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }
.clock { font-family: var(--mono); color: var(--text-tertiary); font-size: 11px; letter-spacing: 0.3px; }
/* ============================================
SWITCHER
PAGE HEADER — IBM heading style
============================================ */
.sw-wrap { display:flex; justify-content:center; padding:32px 24px 0; }
.sw {
display:flex; gap:4px; padding:5px;
background:var(--card); border:1px solid var(--border);
border-radius:14px;
.page-header {
max-width: 1280px; margin: 0 auto;
padding: 32px 32px 0;
}
.sw-btn {
padding:10px 20px; border:none; background:transparent;
color:var(--sec); font-family:var(--mono); font-size:12px;
font-weight:500; border-radius:10px; cursor:pointer;
transition:all .25s var(--ease); white-space:nowrap;
display:flex; align-items:center; gap:6px;
.page-title {
font-family: var(--sans);
font-size: 28px; font-weight: 700;
letter-spacing: -0.5px;
line-height: 1.2;
color: var(--text-primary);
margin-bottom: 8px;
}
.sw-btn:hover{color:var(--text);}
.sw-btn.active{
background:var(--gd); color:var(--g);
box-shadow:0 0 0 1px rgba(34,197,94,0.2);
.page-desc {
font-size: 14px; color: var(--text-secondary);
font-weight: 400; line-height: 1.5;
}
/* ============================================
KPI GRID — 6 cards, research-backed
IBM TABS — Horizontal navigation tabs
============================================ */
.tabs-section {
max-width: 1280px; margin: 0 auto;
padding: 24px 32px 0;
}
.tabs {
display: flex; align-items: center; gap: 0;
border-bottom: 1px solid var(--border-strong);
overflow-x: auto;
scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
padding: 12px 20px;
border: none; background: transparent;
color: var(--text-secondary);
font-family: var(--sans);
font-size: 14px;
font-weight: 600;
cursor: pointer;
position: relative;
white-space: nowrap;
transition: color 0.15s var(--ease-standard);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn::after {
content: '';
position: absolute;
bottom: -1px; left: 0; right: 0;
height: 2px;
background: var(--accent);
transform: scaleX(0);
transform-origin: left;
transition: transform 0.2s var(--ease-standard);
}
.tab-btn.active {
color: var(--accent);
}
.tab-btn.active::after {
transform: scaleX(1);
}
.tab-label { display: flex; align-items: center; gap: 8px; }
.tab-icon {
width: 16px; height: 16px; border-radius: 0;
display: inline-flex; align-items: center; justify-content: center;
font-size: 13px;
}
/* ============================================
KPI GRID — IBM cards, brutal
============================================ */
.kpi-grid {
display:grid; grid-template-columns:repeat(6,1fr);
gap:12px; padding:24px; max-width:1280px; margin:0 auto;
display: grid; grid-template-columns: repeat(6, 1fr);
gap: 1px; padding: 24px 32px; max-width: 1280px; margin: 0 auto;
background: var(--border); border: 1px solid var(--border);
border-radius: 4px; overflow: hidden;
}
.kpi {
background:var(--card); border:1px solid var(--border);
border-radius:12px; padding:16px;
position:relative; overflow:hidden;
transition:all .25s var(--ease);
opacity:0; transform:translateY(12px);
background: var(--surface);
padding: 20px 24px;
position: relative;
transition: background 0.15s;
opacity: 0; transform: translateY(8px);
}
.kpi.vis { opacity:1; transform:translateY(0); }
.kpi:hover{border-color:var(--border-h); transform:translateY(-2px);}
.kpi-accent {
position:absolute; top:0;left:0; width:3px; height:100%; opacity:0; transition:opacity .25s;
}
.kpi:hover .kpi-accent{opacity:1;}
.kpi.visible { opacity: 1; transform: translateY(0); }
.kpi:hover { background: var(--surface-hover); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-name {
font-size:10px; text-transform:uppercase; letter-spacing:.08em;
color:var(--muted); font-weight:600; margin-bottom:8px;
font-size: 11px; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.06em;
color: var(--text-secondary);
}
.kpi-val {
font-family:var(--mono); font-size:22px; font-weight:700;
margin-bottom:6px; line-height:1.1;
.kpi-badge {
font-family: var(--mono); font-size: 10px; font-weight: 500;
padding: 2px 6px; border-radius: 0;
text-transform: uppercase; letter-spacing: 0.05em;
}
.kpi-meta { display:flex; align-items:center; gap:6px; font-size:11px; }
.trend {
display:inline-flex; align-items:center; gap:3px;
padding:2px 6px; border-radius:5px;
font-family:var(--mono); font-weight:600; font-size:10px;
.kpi-badge.up { color: var(--green); background: var(--green-dim); }
.kpi-badge.down { color: var(--red); background: var(--red-dim); }
.kpi-badge.neutral { color: var(--accent); background: var(--accent-dim); }
.kpi-value {
font-family: var(--mono);
font-size: 24px; font-weight: 600;
letter-spacing: -0.5px;
line-height: 1.1;
color: var(--text-primary);
margin-bottom: 8px;
}
.t.up{color:var(--g);background:var(--gd);}
.t.down{color:var(--r);background:var(--rd);}
.t.neu{color:var(--b);background:var(--bd);}
.per { color:var(--muted); font-size:10px; }
.kpi-context { font-size: 11px; color: var(--text-tertiary); }
/* ============================================
CHARTS
CHART PANELS — IBM structure
============================================ */
.cr { display:grid; gap:12px; padding:12px 24px; max-width:1280px; margin:0 auto; }
.cr2 { grid-template-columns:2fr 1fr; }
.cr3 { grid-template-columns:1fr 1fr 1fr; }
.cc {
background:var(--card); border:1px solid var(--border);
border-radius:14px; padding:20px; transition:border-color .25s;
.charts-wrap {
max-width: 1280px; margin: 0 auto;
padding: 0 32px 32px;
display: grid; gap: 1px;
background: var(--border);
border: 1px solid var(--border);
border-radius: 4px; overflow: hidden;
}
.cc:hover{border-color:var(--border-h);}
.ch { margin-bottom:4px; }
.ct { font-size:13px; font-weight:600; color:var(--text); }
.cs { font-size:11px; color:var(--muted); }
.cd { width:100%; height:280px; }
.cd.s { height:200px; }
.charts-row-main { grid-template-columns: 2fr 1fr; }
.charts-row-sub { grid-template-columns: 1fr 1fr 1fr; }
.metric-list { display:flex; flex-direction:column; gap:10px; margin-top:12px; }
.mi { display:flex; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); }
.mi:last-child{border-bottom:none;}
.ml { font-size:12px; color:var(--sec); flex:1; }
.mv { font-family:var(--mono); font-size:12px; font-weight:600; color:var(--text); margin:0 12px; min-width:60px; text-align:right; }
.mb { width:70px; height:4px; background:var(--border); border-radius:2px; overflow:hidden; }
.mf { height:100%; border-radius:2px; width:0; transition:width 1s var(--ease); }
.section-hdr { text-align:center; padding:40px 24px 20px; }
.section-hdr h2 { font-size:clamp(1.6rem,4vw,2.2rem); font-weight:800; letter-spacing:-.5px; margin-bottom:6px; }
.section-hdr p { color:var(--sec); font-size:14px; }
@media(max-width:1024px){
.kpi-grid{grid-template-columns:repeat(3,1fr);}
.cr2,.cr3{grid-template-columns:1fr;}
.chart-panel {
background: var(--surface);
padding: 24px;
min-height: 280px;
}
@media(max-width:640px){
.kpi-grid{grid-template-columns:repeat(2,1fr);}
.sw-btn{padding:8px 12px;font-size:11px;}
.chart-header { margin-bottom: 20px; }
.chart-title {
font-size: 14px; font-weight: 600;
color: var(--text-primary);
margin-bottom: 4px;
}
.chart-subtitle {
font-size: 12px; color: var(--text-tertiary);
}
.chart-canvas { width: 100%; height: 260px; }
.chart-canvas.small { height: 200px; }
/* Metric list inside chart panel */
.metric-list { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.metric-item {
display: flex; align-items: center;
padding: 12px 0;
border-bottom: 1px solid var(--border);
}
.metric-item:last-child { border-bottom: none; }
.metric-item:first-child { padding-top: 0; }
.metric-item:last-child { padding-bottom: 0; }
.m-label { font-size: 12px; color: var(--text-secondary); flex: 1; font-weight: 400; }
.m-value { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 16px; min-width: 64px; text-align: right; }
.m-bar { width: 80px; height: 4px; background: var(--border-strong); border-radius: 0; overflow: hidden; }
.m-fill { height: 100%; width: 0; transition: width 0.8s var(--ease-standard); }
.m-fill.green { background: var(--green); }
.m-fill.red { background: var(--red); }
.m-fill.yellow { background: var(--yellow); }
.m-fill.blue { background: var(--accent); }
/* ============================================
RESPONSIVE
============================================ */
@media(max-width: 1024px) {
.kpi-grid { grid-template-columns: repeat(3, 1fr); }
.charts-row-main, .charts-row-sub { grid-template-columns: 1fr; }
.page-title { font-size: 22px; }
}
@media(max-width: 640px) {
.kpi-grid { grid-template-columns: repeat(2, 1fr); }
.topbar { padding: 0 16px; }
.page-header, .tabs-section, .kpi-grid, .charts-wrap { padding-left: 16px; padding-right: 16px; }
.tab-btn { padding: 12px 14px; font-size: 13px; }
}
</style>
</head>
<body>
<div class="header">
<div class="logo"><span class="dot"></span>ROI24</div>
<div class="hdr-right">
<div class="live"><span class="dot"></span>Live</div>
<!-- TOP BAR -->
<div class="topbar">
<div class="topbar-brand">
<div class="icon">R</div>
ROI24
</div>
<div class="topbar-right">
<div class="status"><div class="status-dot"></div> Live data</div>
<div class="clock" id="clock"></div>
</div>
</div>
<div class="section-hdr">
<h2>Все ключевые цифры — в одном месте</h2>
<p>Переключите бизнес — увидите свои метрики</p>
<!-- PAGE HEADER -->
<div class="page-header">
<h1 class="page-title">Аналитика бизнеса</h1>
<p class="page-desc">Ключевые показатели эффективности в реальном времени</p>
</div>
<div class="sw-wrap">
<div class="sw" id="sw">
<button class="sw-btn active" data-seg="ecom">🛒 Интернет-магазин</button>
<button class="sw-btn" data-seg="services">💼 Услуги / Агентство</button>
<button class="sw-btn" data-seg="production">🏭 Производство</button>
<!-- IBM-STYLE TABS -->
<div class="tabs-section">
<div class="tabs" id="tabs">
<button class="tab-btn active" data-seg="ecom">
<span class="tab-label"><span class="tab-icon">🛒</span>E-commerce</span>
</button>
<button class="tab-btn" data-seg="services">
<span class="tab-label"><span class="tab-icon">💼</span>Услуги</span>
</button>
<button class="tab-btn" data-seg="production">
<span class="tab-label"><span class="tab-icon">🏭</span>Производство</span>
</button>
</div>
</div>
<div id="dash">
<div class="kpi-grid" id="kpi-grid"></div>
<div class="cr cr2">
<div class="cc">
<div class="ch"><div class="ct" id="mc-title"></div><div class="cs" id="mc-sub"></div></div>
<div class="cd" id="mc"></div>
</div>
<div class="cc">
<div class="ch"><div class="ct" id="sc-title"></div><div class="cs" id="sc-sub"></div></div>
<div class="cd" id="sc"></div>
</div>
</div>
<div class="cr cr3">
<div class="cc">
<div class="ch"><div class="ct" id="c1-title"></div><div class="cs" id="c1-sub"></div></div>
<div class="cd s" id="c1"></div>
</div>
<div class="cc">
<div class="ch"><div class="ct" id="c2-title"></div><div class="cs" id="c2-sub"></div></div>
<div class="cd s" id="c2"></div>
</div>
<div class="cc">
<div class="ch"><div class="ct">Выполнение плана</div><div class="cs">Ключевые метрики</div></div>
<div class="metric-list" id="mlist"></div>
</div>
</div>
<!-- KPI GRID -->
<div class="kpi-grid" id="kpi-grid"></div>
<!-- CHARTS -->
<div class="charts-wrap">
<div class="charts-row-main" id="charts-main"></div>
<div class="charts-row-sub" id="charts-sub"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js"></script>
<script>
/* ============================================
DATA — KPIs from research:
E-com: Revenue, AOV, CVR, CAC, CLV, ROAS (Shopify)
Services: Revenue, Win Rate, Sales Cycle, Pipeline Coverage, CPL, ROMI (Optifai)
Production: Volume, OEE, Defect Rate, Cost/Unit, Inventory Turnover, ROMI
============================================ */
const D = {
ecom: {
kpis: [
@@ -231,12 +307,12 @@ const D = {
{ n:'CLV', v:'12 400 ₽', d:'+18%', t:'up', p:'за 6 мес' },
{ n:'ROAS', v:'4.2×', d:'+15%', t:'up', p:'возврат рекламы' },
],
mc: { title:'Выручка и расходы на рекламу', sub:'12 месяцев · выручка (зелёный) vs маркетинг-бюджет (синий)', type:'dual',
mc: { title:'Выручка и расходы на рекламу', sub:'12 месяцев · выручка (зелёный) vs маркетинг-бюджет (пунктир)', type:'dual',
labels:['Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'],
rev:[2.8,3.1,2.9,3.4,3.6,3.2,3.8,4.0,3.9,4.2,3.7,4.2],
ads:[0.6,0.7,0.65,0.72,0.68,0.75,0.7,0.65,0.6,0.58,0.62,0.55],
},
sc: { title:'ROAS по каналам', sub:'Возврат на каждый рубль рекламы', type:'bar-h',
sc: { title:'ROAS по каналам', sub:'Возврат инвестиций в каждый канал', type:'bar-h',
data:[
{n:'SEO',v:520},{n:'Email',v:380},{n:'Прямой',v:280},
{n:'Контекст',v:150},{n:'Соцсети',v:120},{n:'Рефералы',v:95},
@@ -253,11 +329,11 @@ const D = {
data:[120,98,76,54,42],
},
metrics: [
{l:'Выручка (план)',v:'4.2М',p:93,c:'var(--g)'},
{l:'CVR (план)',v:'3.8%',p:95,c:'var(--g)'},
{l:'ROAS (план)',v:'4.2×',p:105,c:'var(--g)'},
{l:'CAC (план)',v:'680₽',p:85,c:'var(--a)'},
{l:'CLV (план)',v:'12.4К',p:104,c:'var(--g)'},
{l:'Выручка (план)',v:'4.2М',p:93,c:'green'},
{l:'CVR (план)',v:'3.8%',p:95,c:'green'},
{l:'ROAS (план)',v:'4.2×',p:105,c:'green'},
{l:'CAC (план)',v:'680₽',p:85,c:'yellow'},
{l:'CLV (план)',v:'12.4К',p:104,c:'green'},
],
},
services: {
@@ -291,11 +367,11 @@ const D = {
data:[112,95,88,105,78],
},
metrics: [
{l:'Пайплайн (план)',v:'12.8М',p:85,c:'var(--b)'},
{l:'Win Rate (план)',v:'24%',p:96,c:'var(--g)'},
{l:'Sales Cycle (план)',v:'32д',p:90,c:'var(--g)'},
{l:'Pipeline Cov. (план)',v:'4.1×',p:103,c:'var(--g)'},
{l:'ROMI (план)',v:'245%',p:123,c:'var(--g)'},
{l:'Пайплайн (план)',v:'12.8М',p:85,c:'blue'},
{l:'Win Rate (план)',v:'24%',p:96,c:'green'},
{l:'Sales Cycle (план)',v:'32д',p:90,c:'green'},
{l:'Pipeline Cov. (план)',v:'4.1×',p:103,c:'green'},
{l:'ROMI (план)',v:'245%',p:123,c:'green'},
],
},
production: {
@@ -329,190 +405,301 @@ const D = {
data:[45,25,12,10,8],
},
metrics: [
{l:'Выпуск (план)',v:'15.4К',p:96,c:'var(--g)'},
{l:'OEE (план)',v:'78%',p:92,c:'var(--a)'},
{l:'Брак (план)',v:'2.1%',p:105,c:'var(--g)'},
{l:'ROMI (план)',v:'310%',p:111,c:'var(--g)'},
{l:'Себест. (план)',v:'3.2К',p:94,c:'var(--b)'},
{l:'Выпуск (план)',v:'15.4К',p:96,c:'green'},
{l:'OEE (план)',v:'78%',p:92,c:'yellow'},
{l:'Брак (план)',v:'2.1%',p:105,c:'green'},
{l:'ROMI (план)',v:'310%',p:111,c:'green'},
{l:'Себест. (план)',v:'3.2К',p:94,c:'blue'},
],
},
};
let charts = {};
function seg(key) {
const s = D[key];
document.querySelectorAll('.sw-btn').forEach(b => b.classList.toggle('active', b.dataset.seg === key));
// Tabs
document.querySelectorAll('.tab-btn').forEach(b => b.classList.toggle('active', b.dataset.seg === key));
// KPIs
const g = document.getElementById('kpi-grid');
g.innerHTML = s.kpis.map((d,i) => `
<div class="kpi" style="transition-delay:${i*80}ms">
<div class="kpi-accent" style="background:${i<3?'var(--g)':i<5?'var(--b)':'var(--p)'}"></div>
<div class="kpi-name">${d.n}</div>
<div class="kpi-val">${d.v}</div>
<div class="kpi-meta">
<span class="trend ${d.t}">${d.t==='up'?'↑':d.t==='down'?'↓':'→'} ${d.d}</span>
<span class="per">${d.p}</span>
g.innerHTML = s.kpis.map((d,i) => {
const badgeClass = d.t;
const arrow = d.t === 'up' ? '▲' : d.t === 'down' ? '▼' : '●';
return `<div class="kpi" style="transition-delay:${i*60}ms">
<div class="kpi-top">
<span class="kpi-name">${d.n}</span>
<span class="kpi-badge ${badgeClass}">${arrow} ${d.d}</span>
</div>
</div>`).join('');
requestAnimationFrame(() => g.querySelectorAll('.kpi').forEach(c=>c.classList.add('vis')));
<div class="kpi-value">${d.v}</div>
<div class="kpi-context">${d.p}</div>
</div>`;
}).join('');
requestAnimationFrame(() => g.querySelectorAll('.kpi').forEach(c => c.classList.add('visible')));
// Main chart area
const mcDom = document.getElementById('charts-main');
const mc = s.mc;
if (!charts.mc) charts.mc = echarts.init(document.createElement('div'));
mcDom.innerHTML = `<div class="chart-panel" id="cp-main">
<div class="chart-header">
<div class="chart-title">${mc.title}</div>
<div class="chart-subtitle">${mc.sub}</div>
</div>
<div class="chart-canvas" id="mc-canvas"></div>
</div>
<div class="chart-panel" id="cp-side">
<div class="chart-header">
<div class="chart-title">${s.sc.title}</div>
<div class="chart-subtitle">${s.sc.sub}</div>
</div>
<div class="chart-canvas" id="sc-canvas"></div>
</div>`;
// Main chart
const mc = s.mc;
const mcDom = document.getElementById('mc');
if (!charts.mc) charts.mc = echarts.init(mcDom);
document.getElementById('mc-title').textContent = mc.title;
document.getElementById('mc-sub').textContent = mc.sub;
let opt;
if (mc.type==='dual') {
opt = {
tooltip:{trigger:'axis',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
legend:{data:['Доход','Расход'],textStyle:{color:'#52525b',fontSize:10},top:0},
grid:{left:44,right:16,top:28,bottom:28},
xAxis:{type:'category',data:mc.labels,
axisLine:{lineStyle:{color:'#1e1e22'}},axisLabel:{color:'#52525b',fontSize:10}},
yAxis:{type:'value',splitLine:{lineStyle:{color:'#1a1a1e'}},axisLabel:{color:'#52525b',fontSize:10,formatter:'{value}М'}},
series:[
{name:'Доход',type:'line',data:mc.rev,smooth:.4,symbol:'none',lineStyle:{width:2.5,color:'#22c55e'},
areaStyle:{color:new echarts.graphic.LinearGradient(0,0,0,1,[
{offset:0,color:'rgba(34,197,94,0.2)'},{offset:1,color:'rgba(34,197,94,0.01)'}])}},
{name:'Расход',type:'line',data:mc.ads,smooth:.4,symbol:'none',
lineStyle:{width:2,color:'#3b82f6',type:'dashed'},
areaStyle:{color:new echarts.graphic.LinearGradient(0,0,0,1,[
{offset:0,color:'rgba(59,130,246,0.08)'},{offset:1,color:'rgba(59,130,246,0.01)'}])}},
const mcEl = document.getElementById('mc-canvas');
charts.mc.dispose();
charts.mc = echarts.init(mcEl);
let mcOpt;
if (mc.type === 'dual') {
mcOpt = {
tooltip: { trigger: 'axis', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 12, fontFamily: 'IBM Plex Mono' } },
legend: { data: ['Доход', 'Расход'], textStyle: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Sans' }, top: 0, itemWidth: 12, itemHeight: 2 },
grid: { left: 48, right: 20, top: 32, bottom: 28 },
xAxis: {
type: 'category', data: mc.labels,
axisLine: { lineStyle: { color: '#262626' } },
axisLabel: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Mono' },
axisTick: { show: false },
},
yAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#1f1f1f' } },
axisLabel: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Mono', formatter: '{value}М' },
},
series: [
{
name: 'Доход', type: 'line', data: mc.rev, smooth: 0.4, symbol: 'none',
lineStyle: { width: 2.5, color: '#16a34a' },
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgba(22,163,74,0.15)' },
{ offset: 1, color: 'rgba(22,163,74,0.01)' }
])
}
},
{
name: 'Расход', type: 'line', data: mc.ads, smooth: 0.4, symbol: 'none',
lineStyle: { width: 1.5, color: '#0f6fff', type: 'dashed' },
},
],
animationDuration:600,
animationDuration: 500,
animationEasing: 'cubicOut',
};
} else if (mc.type==='bar-cmp') {
opt = {
tooltip:{trigger:'axis',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
legend:{data:['План','Факт'],textStyle:{color:'#52525b',fontSize:10},top:0},
grid:{left:44,right:16,top:28,bottom:28},
xAxis:{type:'category',data:mc.labels,
axisLine:{lineStyle:{color:'#1e1e22'}},axisLabel:{color:'#52525b',fontSize:10}},
yAxis:{type:'value',splitLine:{lineStyle:{color:'#1a1a1e'}},axisLabel:{color:'#52525b',fontSize:10,formatter:'{value}К'}},
series:[
{name:'План',type:'bar',data:mc.plan,barWidth:'35%',itemStyle:{color:'rgba(59,130,246,0.15)',borderRadius:[4,4,0,0]}},
{name:'Факт',type:'bar',data:mc.fact,barWidth:'35%',itemStyle:{color:'#3b82f6',borderRadius:[4,4,0,0]}},
} else {
mcOpt = {
tooltip: { trigger: 'axis', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 12, fontFamily: 'IBM Plex Mono' } },
legend: { data: ['План', 'Факт'], textStyle: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Sans' }, top: 0, itemWidth: 12, itemHeight: 14 },
grid: { left: 48, right: 20, top: 32, bottom: 28 },
xAxis: {
type: 'category', data: mc.labels,
axisLine: { lineStyle: { color: '#262626' } },
axisLabel: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Mono' },
},
yAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#1f1f1f' } },
axisLabel: { color: '#6f6f6f', fontSize: 11, fontFamily: 'IBM Plex Mono', formatter: '{value}К' },
},
series: [
{ name: 'План', type: 'bar', data: mc.plan, barWidth: '30%', itemStyle: { color: 'rgba(15,111,255,0.1)' } },
{ name: 'Факт', type: 'bar', data: mc.fact, barWidth: '30%', itemStyle: { color: '#0f6fff' } },
],
animationDuration:600,
animationDuration: 500,
animationEasing: 'cubicOut',
};
}
charts.mc.setOption(opt, true);
charts.mc.setOption(mcOpt, true);
// Side chart (bar horizontal)
// Side chart
const sc = s.sc;
const scDom = document.getElementById('sc');
if (!charts.sc) charts.sc = echarts.init(scDom);
document.getElementById('sc-title').textContent = sc.title;
document.getElementById('sc-sub').textContent = sc.sub;
const cols = ['#22c55e','#06b6d4','#a855f7','#3b82f6','#f59e0b','#ef4444'];
const scEl = document.getElementById('sc-canvas');
if (!charts.sc) charts.sc = echarts.init(scEl);
charts.sc.dispose();
charts.sc = echarts.init(scEl);
const scData = sc.data.reverse();
const scColors = ['#0f6fff', '#3d8eff', '#16a34a', '#06b6d4', '#a855f7', '#eac518'];
const scOpt = {
tooltip:{trigger:'axis',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
grid:{left:80,right:30,top:10,bottom:10},
xAxis:{type:'value',splitLine:{lineStyle:{color:'#1a1a1e'}},axisLabel:{color:'#52525b',fontSize:9,formatter:'{value}%'}},
yAxis:{type:'category',data:scData.map(d=>d.n),axisLine:{lineStyle:{color:'#1e1e22'}},axisLabel:{color:'#a1a1aa',fontSize:10}},
series:[{
type:'bar',data:scData.map(d=>d.v),barWidth:38,
itemStyle:{
borderRadius:[0,5,5,0],
color:function(p){const c=cols[p.dataIndex%cols.length];return new echarts.graphic.LinearGradient(0,0,1,0,[{offset:0,color:c+'88'},{offset:1,color:c}]);}
}
tooltip: { trigger: 'axis', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 11 } },
grid: { left: 90, right: 28, top: 8, bottom: 8 },
xAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#1f1f1f' } },
axisLabel: { color: '#6f6f6f', fontSize: 10, fontFamily: 'IBM Plex Mono', formatter: '{value}%' },
},
yAxis: {
type: 'category', data: scData.map(d => d.n),
axisLine: { lineStyle: { color: '#262626' } },
axisLabel: { color: '#a6a6a6', fontSize: 11, fontFamily: 'IBM Plex Sans' },
},
series: [{
type: 'bar', data: scData.map((d, i) => ({
value: d.v,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: scColors[i % scColors.length] + '66' },
{ offset: 1, color: scColors[i % scColors.length] }
])
}
})),
barWidth: 28,
}],
animationDuration:600,
animationDuration: 500,
};
charts.sc.setOption(scOpt, true);
// Chart 1: Funnel
// Sub row charts
const subEl = document.getElementById('charts-sub');
const c1 = s.c1;
const c1Dom = document.getElementById('c1');
if (!charts.c1) charts.c1 = echarts.init(c1Dom);
document.getElementById('c1-title').textContent = c1.title;
document.getElementById('c1-sub').textContent = c1.sub;
const fc = ['#22c55e','#06b6d4','#a855f7','#ef4444'];
const c1Opt = {
tooltip:{trigger:'item',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
series:[{
type:'funnel',left:'10%',bottom:5,width:'80%',min:0,max:c1.data[0].v,
minSize:'0%',maxSize:'100%',sort:'descending',gap:4,
label:{show:true,position:'inside',color:'#fff',fontSize:11,formatter:'{b}\n{c} ({d}%)'},
labelLine:{show:false},itemStyle:{borderColor:'#111',borderWidth:2},
data:c1.data.map((d,i)=>({name:d.n,value:d.v,itemStyle:{color:fc[i%fc.length]}})),
}],
animationDuration:600,
};
charts.c1.setOption(c1Opt, true);
// Chart 2: depends on segment (pie or bar)
const c2 = s.c2;
const c2Dom = document.getElementById('c2');
if (!charts.c2) charts.c2 = echarts.init(c2Dom);
document.getElementById('c2-title').textContent = c2.title;
document.getElementById('c2-sub').textContent = c2.sub;
// Funnel chart
let funnelHtml = `<div class="chart-panel">
<div class="chart-header">
<div class="chart-title">${c1.title}</div>
<div class="chart-subtitle">${c1.sub}</div>
</div>
<div class="chart-canvas small" id="c1-canvas"></div>
</div>`;
// Second chart
let secondHtml;
if (c2.labels) {
// bar or pie depending on data
const isPie = c2.data.length && c2.data.reduce((a,b)=>a+b,0) <= 100;
const pc = ['#22c55e','#3b82f6','#f59e0b','#a855f7','#ef4444'];
const isPie = c2.data.length && c2.data.reduce((a, b) => a + b, 0) <= 100;
const pc = ['#0f6fff', '#16a34a', '#eac518', '#a855f7', '#e21d1d'];
if (isPie) {
secondHtml = `<div class="chart-panel">
<div class="chart-header">
<div class="chart-title">${c2.title}</div>
<div class="chart-subtitle">${c2.sub}</div>
</div>
<div class="chart-canvas small" id="c2-canvas"></div>
</div>`;
} else {
secondHtml = `<div class="chart-panel">
<div class="chart-header">
<div class="chart-title">${c2.title}</div>
<div class="chart-subtitle">${c2.sub}</div>
</div>
<div class="chart-canvas small" id="c2-canvas"></div>
</div>`;
}
}
// Metrics panel
const metricsHtml = `<div class="chart-panel">
<div class="chart-header">
<div class="chart-title">Выполнение плана</div>
<div class="chart-subtitle">Ключевые метрики</div>
</div>
<div class="metric-list" id="metric-list"></div>
</div>`;
subEl.innerHTML = funnelHtml + secondHtml + metricsHtml;
// Funnel
const fc = ['#0f6fff', '#3d8eff', '#16a34a', '#e21d1d'];
const c1Dom = document.getElementById('c1-canvas');
if (!charts.c1) charts.c1 = echarts.init(c1Dom);
charts.c1.dispose();
charts.c1 = echarts.init(c1Dom);
charts.c1.setOption({
tooltip: { trigger: 'item', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 11 } },
series: [{
type: 'funnel', left: '8%', bottom: 5, width: '84%', min: 0, max: c1.data[0].v,
minSize: '0%', maxSize: '100%', sort: 'descending', gap: 2,
label: { show: true, position: 'inside', color: '#f4f4f4', fontSize: 11, fontFamily: 'IBM Plex Mono', formatter: '{b}\n{d}%' },
labelLine: { show: false },
itemStyle: { borderColor: '#161616', borderWidth: 2 },
data: c1.data.map((d, i) => ({ name: d.n, value: d.v, itemStyle: { color: fc[i % fc.length] } })),
}],
animationDuration: 500,
}, true);
// Second chart
const c2Dom = document.getElementById('c2-canvas');
if (!charts.c2) charts.c2 = echarts.init(c2Dom);
charts.c2.dispose();
charts.c2 = echarts.init(c2Dom);
if (c2.labels) {
const isPie = c2.data.length && c2.data.reduce((a, b) => a + b, 0) <= 100;
const pc = ['#0f6fff', '#16a34a', '#eac518', '#a855f7', '#e21d1d'];
if (isPie) {
charts.c2.setOption({
tooltip:{trigger:'item',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
series:[{
type:'pie',radius:['45%','70%'],center:['50%','55%'],
itemStyle:{borderRadius:6,borderColor:'#111',borderWidth:3},
label:{show:false},labelLine:{show:false},
data:c2.labels.map((l,i)=>({name:l,value:c2.data[i],itemStyle:{color:pc[i%pc.length]}})),
emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:'rgba(0,0,0,0.3)'}},
tooltip: { trigger: 'item', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 11 } },
series: [{
type: 'pie', radius: ['40%', '65%'], center: ['50%', '55%'],
itemStyle: { borderRadius: 0, borderColor: '#161616', borderWidth: 2 },
label: { show: false }, labelLine: { show: false },
data: c2.labels.map((l, i) => ({ name: l, value: c2.data[i], itemStyle: { color: pc[i % pc.length] } })),
}],
animationDuration:600,
animationDuration: 500,
}, true);
} else {
charts.c2.setOption({
tooltip:{trigger:'axis',backgroundColor:'#111',borderColor:'#222',textStyle:{color:'#fafafa',fontSize:11}},
grid:{left:60,right:16,top:10,bottom:28},
xAxis:{type:'value',splitLine:{lineStyle:{color:'#1a1a1e'}},axisLabel:{color:'#52525b',fontSize:9,formatter:'{value}%'}},
yAxis:{type:'category',data:c2.labels,
axisLine:{lineStyle:{color:'#1e1e22'}},axisLabel:{color:'#a1a1aa',fontSize:10}},
series:[{
type:'bar',data:c2.data,barWidth:30,
itemStyle:{
borderRadius:[4,4,0,0],
color:function(p){return p.data===undefined ? '#22c55e' : (p.data>=100?'#22c55e':'var(--a)');}
},
tooltip: { trigger: 'axis', backgroundColor: '#161616', borderColor: '#262626', textStyle: { color: '#f4f4f4', fontSize: 11 } },
grid: { left: 60, right: 16, top: 8, bottom: 28 },
xAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#1f1f1f' } },
axisLabel: { color: '#6f6f6f', fontSize: 10, formatter: '{value}%' },
},
yAxis: {
type: 'category', data: c2.labels,
axisLine: { lineStyle: { color: '#262626' } },
axisLabel: { color: '#a6a6a6', fontSize: 11, fontFamily: 'IBM Plex Sans' },
},
series: [{
type: 'bar', data: c2.data.map(v => ({
value: v,
itemStyle: { color: v >= 100 ? '#16a34a' : '#eac518' }
})),
barWidth: 24,
}],
animationDuration:600,
animationDuration: 500,
}, true);
}
}
// Metrics list
const ml = document.getElementById('mlist');
const ml = document.getElementById('metric-list');
ml.innerHTML = s.metrics.map(m => `
<div class="mi">
<span class="ml">${m.l}</span>
<span class="mv">${m.v}</span>
<div class="mb"><div class="mf" data-p="${m.p}" style="background:${m.c}"></div></div>
<div class="metric-item">
<span class="m-label">${m.l}</span>
<span class="m-value">${m.v}</span>
<div class="m-bar"><div class="m-fill ${m.c}" data-p="${m.p}"></div></div>
</div>`).join('');
requestAnimationFrame(() => setTimeout(() => {
ml.querySelectorAll('.mf').forEach(f=>f.style.width=f.dataset.p+'%');
ml.querySelectorAll('.m-fill').forEach(f => f.style.width = f.dataset.p + '%');
}, 100));
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('sw').addEventListener('click', e => {
const b = e.target.closest('.sw-btn');
document.getElementById('tabs').addEventListener('click', e => {
const b = e.target.closest('.tab-btn');
if (!b) return;
seg(b.dataset.seg);
});
seg('ecom');
function tick() {
const n=new Date();
const n = new Date();
document.getElementById('clock').textContent =
String(n.getHours()).padStart(2,'0')+':'+String(n.getMinutes()).padStart(2,'0')+':'+String(n.getSeconds()).padStart(2,'0');
String(n.getHours()).padStart(2, '0') + ':' + String(n.getMinutes()).padStart(2, '0') + ':' + String(n.getSeconds()).padStart(2, '0');
}
tick(); setInterval(tick, 1000);
new ResizeObserver(() => Object.values(charts).forEach(c=>c.resize())).observe(document.getElementById('dash'));
new ResizeObserver(() => Object.values(charts).forEach(c => c.resize())).observe(document.getElementById('charts-wrap'));
});
</script>
</body>