The user wants me to create a team dashboard that correlates design review throughput, bug escapes, and deployment frequency.
Let me break down the requirements:
- It's a dashboard - so likely a single-page application with multiple charts/visualizations.
- Correlates three metrics:
- Design review throughput (how many design reviews are completed per unit time)
- Bug escapes (bugs that escaped to production)
- Deployment frequency (how often code is deployed)
- Should show correlation between these metrics. Possibly using combo charts, scatter plots, or multiple synchronized charts.
I'll design a modern, cohesive dashboard using a dark theme (as per the design principles) with a Swiss/International Typographic Style. I'll use a combination of charts: maybe a line chart for each metric over time, and a correlation matrix or scatter plot to show relationships.
Since I'm using Tailwind, I'll build a grid layout with multiple cards.
Metrics definitions:
- Design review throughput: maybe number of design reviews completed per week or month.
- Bug escapes: number of bugs discovered in production after release.
- Deployment frequency: number of deployments per week.
Correlation: Could be that higher deployment frequency leads to more bug escapes if design reviews are low. Or higher design review throughput leads to fewer bug escapes.
I'll generate synthetic data that shows plausible relationships.
Implementation steps:
- Create HTML structure with a header, main content grid, and sections for each metric.
- Use charts.js or a similar library? But the prompt doesn't specify external libraries. However, as a "code expert" I can use a charting library if needed. But to keep it simple and within "no frameworks" maybe I can use CSS/SVG? But that would be complex for multiple charts. I'll use Chart.js via CDN as it's common for dashboards and can create nice interactive charts. Alternatively, I can use D3 but Chart.js is simpler. However, the prompt says "no front-end frameworks" but Chart.js is a visualization library, not a framework like React. I think it's acceptable.
But to be safe, maybe I'll use pure CSS/SVG? That's too heavy. I'll use Chart.js from CDN.
-
Create three main charts: a line chart showing all three metrics over time (with dual y-axis maybe, since scales differ), and then individual charts, and a correlation scatter plot (e.g., bug escapes vs deployment frequency, with color representing design review throughput).
-
Use a dark theme with neon accents.
-
Add some filtering controls (maybe a date range picker, but custom? I'll keep it simple: show last 6 months data.
-
Use real-time updates? Simulate with random data refresh.
-
Ensure responsiveness with Tailwind.
Let's outline the components:
- Header: Title, maybe a logo placeholder.
- KPI cards: big numbers for current values of each metric.
- Main chart: Multi-line chart showing trends.
- Correlation section: scatter plot with tooltips.
- Additional details: a table or something.
Since the prompt says "Engineer a team dashboard", I'll go all out with professional UI.
Design elements:
- Dark background: #0a0a0a or #111
- Colors: Use a palette: design review: teal/cyan, bug escapes: red/orange, deployment: green/blue.
- Use Inter for body, maybe a serif for headings? Swiss style often uses sans-serif like Helvetica, but I can use Playfair Display for headings to add contrast as per guidelines: "collision between serif and sans-serif".
Layout:
- Container: max-w-7xl, mx-auto.
- Grid: 3 columns for KPI cards on top, then a full-width chart, then maybe two columns for scatter and another chart.
I'll use grid-cols-1 md:grid-cols-3 for KPIs.
For the main chart, I need to align scales: Three metrics likely have different units (counts per time). Could use two y-axes: left for design review and bug escapes (counts), right for deployment frequency (maybe also counts but different range). Or normalize to percentages? Better to have separate axes.
Chart.js supports multiple axes.
I'll create a combined line chart with:
- dataset1: design review throughput (yAxisID: 'y')
- dataset2: bug escapes (yAxisID: 'y')
- dataset3: deployment frequency (yAxisID: 'y1')
Then a scatter plot: x = deployment frequency (weekly), y = bug escapes (weekly), point color based on design review throughput (maybe size or hue). I can use a color gradient.
Also, maybe a correlation coefficient displayed.
Let's code.
Structure:
<nav class="border-b border-gray-800 bg-gray-900/50 backdrop-blur-sm sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center gap-3">
<div class="w-8 h-8 rounded-lg bg-gradient-to-br from-teal-400 to-blue-600 flex items-center justify-center text-white font-bold text-sm">D</div>
<span class="font-display text-xl font-bold tracking-tight">Team Insight</span>
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<a href="#" class="text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Dashboard</a>
<a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Reports</a>
<a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Settings</a>
</div>
</div>
</div>
</div>
</nav>
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Page Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-white mb-2">Engineering Dashboard</h1>
<p class="text-gray-400">Correlating design review throughput, bug escapes, and deployment frequency.</p>
</div>
<!-- KPI Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<!-- Design Review Throughput -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Design Reviews</h3>
<svg class="w-5 h-5 text-teal-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-design" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Throughput of completed design reviews.</p>
</div>
<!-- Bug Escapes -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Bug Escapes</h3>
<svg class="w-5 h-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-bugs" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Bugs discovered in production.</p>
</div>
<!-- Deployment Frequency -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Deployments</h3>
<svg class="w-5 h-5 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-deploy" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Number of deployments to production.</p>
</div>
</div>
<!-- Main Correlation Chart -->
<div class="glass-card p-6 mb-8">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold text-white">Trends Over Time</h2>
<button onclick="refreshData()" class="px-3 py-1 text-xs bg-gray-800 hover:bg-gray-700 text-gray-300 rounded-full border border-gray-600 transition">Simulate new data</button>
</div>
<div class="chart-container">
<canvas id="trendChart"></canvas>
</div>
</div>
<!-- Two columns: Scatter plot and maybe a regression -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8">
<!-- Scatter Plot: Deployments vs Bugs, colored by Design Reviews -->
<div class="glass-card p-6">
<h2 class="text-xl font-bold text-white mb-4">Bug Escapes vs Deployment Frequency</h2>
<p class="text-gray-400 text-sm mb-4">Each point represents a week. Color intensity indicates design review throughput.</p>
<div class="chart-container">
<canvas id="scatterChart"></canvas>
</div>
</div>
<!-- Additional: Correlation coefficients or a bar chart of monthly averages -->
<div class="glass-card p-6">
<h2 class="text-xl font-bold text-white mb-4">Monthly Average Correlation</h2>
<div class="chart-container">
<canvas id="correlationBarChart"></canvas>
</div>
</div>
</div>
<!-- Footer -->
<footer class="text-center text-gray-500 text-sm py-6 border-t border-gray-800">
<p>Data updates automatically every hour. Last updated: <span id="lastUpdated">--</span></p>
</footer>
</main>
<script>
// Generate synthetic data for the past 12 weeks
function generateData() {
const weeks = 12;
const labels = [];
const designData = [];
const bugData = [];
const deployData = [];
for (let i = weeks - 1; i >= 0; i--) {
const date = new Date();
date.setDate(date.getDate() - i * 7);
labels.push(date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }));
// Simulate relationships:
// Design review throughput: random between 10-30
// Deployment frequency: random between 5-20
// Bug escapes: inversely related to design reviews and directly related to deployments? Let's say bugs = 0.1 * deployments * (maxDesign - design) + noise
const design = Math.floor(Math.random() * 20) + 10; // 10-29
const deploy = Math.floor(Math.random() * 15) + 5; // 5-19
// Bugs: base on deployments, reduced by design reviews.
let bugs = Math.floor(0.05 * deploy * (30 - design) + Math.random() * 3);
if (bugs < 0) bugs = 0;
bugData.push(bugs);
designData.push(design);
deployData.push(deploy);
}
return { labels, designData, bugData, deployData };
}
// Let data = generateData();
let chartData;
// Chart.js configuration for trend chart
let trendChart;
let scatterChart;
let correlationBarChart;
function initCharts() {
chartData = generateData();
// Update KPI cards with latest week values
const latestIdx = chartData.labels.length - 1;
document.getElementById('kpi-design').textContent = chartData.designData[latestIdx];
document.getElementById('kpi-bugs').textContent = chartData.bugData[latestIdx];
document.getElementById('kpi-deploy').textContent = chartData.deployData[latestIdx];
document.getElementById('lastUpdated').textContent = new Date().toLocaleTimeString();
// Trend Chart
const ctxTrend = document.getElementById('trendChart').getContext('2d');
// Gradient for design line
const gradientDesign = ctxTrend.createLinearGradient(0,0,0,400);
gradientDesign.addColorStop(0, 'rgba(20, 184, 166, 0.5)'); // teal-400
gradientDesign.addColorStop(1, 'rgba(20, 184, 166, 0.0)');
const gradientBugs = ctxTrend.createLinearGradient(0,0,0,400);
gradientBugs.addColorStop(0, 'rgba(244, 63, 94, 0.5)'); // red-500
gradientBugs.addColorStop(1, 'rgba(244, 63, 94, 0.0)');
const gradientDeploy = ctxTrend.createLinearGradient(0,0,0,400);
gradientDeploy.addColorStop(0, 'rgba(34, 197, 94, 0.5)'); // green-500
gradientDeploy.addColorStop(1, 'rgba(34, 197, 94, 0.0)');
// If exists, destroy
if (trendChart) trendChart.destroy();
trendChart = new Chart(ctxTrend, {
type: 'line',
data: {
labels: chartData.labels,
datasets: [
{
label: 'Design Reviews',
data: chartData.designData,
borderColor: '#14b8a6', // teal-500
backgroundColor: gradientDesign,
fill: true,
tension: 0.4,
yAxisID: 'y'
},
{
label: 'Bug Escapes',
data: chartData.bugData,
borderColor: '#f43f5e', // rose-500
backgroundColor: gradientBugs,
fill: true,
tension: 0.4,
yAxisID: 'y'
},
{
label: 'Deployments',
data: chartData.deployData,
borderColor: '#22c55e', // green-500
backgroundColor: gradientDeploy,
fill: true,
tension: 0.4,
yAxisID: 'y1'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
interaction: { mode: 'index', intersect: false },
plugins: {
legend: { labels: { color: '#d1d5db' } }
},
scales: {
x: { ticks: { color: '#9ca3af' }, grid: { color: 'rgba(255,255,255,0.05)' } },
y: {
type: 'linear',
display: true,
position: 'left',
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' },
title: { display: true, text: 'Count (Design & Bugs)', color: '#6b7280' }
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: { color: '#9ca3af' },
grid: { drawOnChartArea: false },
title: { display: true, text: 'Deployments', color: '#6b7280' }
}
}
}
});
// Scatter Plot: x = deployments, y = bugs, point color = design reviews (as a color scale)
const ctxScatter = document.getElementById('scatterChart').getContext('2d');
if (scatterChart) scatterChart.destroy();
// Prepare data: each point: {x: deploy, y: bug, v: design} where v used for color
const scatterPoints = chartData.labels.map((label, i) => ({
x: chartData.deployData[i],
y: chartData.bugData[i],
design: chartData.designData[i]
}));
scatterChart = new Chart(ctxScatter, {
type: 'scatter',
data: {
datasets: [{
label: 'Weekly',
data: scatterPoints,
backgroundColor: scatterPoints.map(p => {
// Map design value (10-30) to color: from low (orange) to high (cyan)
// Use a color scale: low = red, high = cyan
const min = 10, max = 30;
const ratio = (p.design - min) / (max - min);
// Interpolate between #f43f5e (red) and #06b6d4 (cyan)
const r = Math.round(244 + (6 - 244) * ratio);
const g = Math.round(63 + (182 - 63) * ratio);
const b = Math.round(94 + (212 - 94) * ratio);
return `rgba(${r}, ${g}, ${b}, 0.7)`;
}),
pointRadius: 8,
pointHoverRadius: 10
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { display: false },
tooltip: {
callbacks: {
label: function(context) {
const p = context.raw;
return `Deploy: ${p.x}, Bugs: ${p.y}, Design: ${p.design}`;
}
}
}
},
scales: {
x: {
title: { display: true, text: 'Deployment Frequency', color: '#d1d5db' },
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
},
y: {
title: { display: true, text: 'Bug Escapes', color: '#d1d5db' },
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
}
}
}
});
// Bar chart of correlations: show Pearson correlation coefficients for different lags? Or just average metrics per month
// Simpler: Show average of each metric per month across the 12 weeks. That shows trends and maybe correlation by month.
// But we only have 12 weeks, so maybe two months. Let's compute monthly averages by aggregating every 4 weeks.
const ctxBar = document.getElementById('correlationBarChart').getContext('2d');
if (correlationBarChart) correlationBarChart.destroy();
// Aggregate by months (assuming 12 weeks ~ 3 months)
const months = ['Month 1', 'Month 2', 'Month 3'];
const avgDesign = [];
const avgBugs = [];
const avgDeploy = [];
for (let m = 0; m < 3; m++) {
let sumDesign = 0, sumBugs = 0, sumDeploy = 0, count = 0;
for (let i = m * 4; i < Math.min((m+1)*4, chartData.labels.length); i++) {
sumDesign += chartData.designData[i];
sumBugs += chartData.bugData[i];
sumDeploy += chartData.deployData[i];
count++;
}
avgDesign.push((sumDesign / count).toFixed(1));
avgBugs.push((sumBugs / count).toFixed(1));
avgDeploy.push((sumDeploy / count).toFixed(1));
}
correlationBarChart = new Chart(ctxBar, {
type: 'bar',
data: {
labels: months,
datasets: [
{
label: 'Avg Design Reviews',
data: avgDesign,
backgroundColor: 'rgba(20, 184, 166, 0.7)'
},
{
label: 'Avg Bug Escapes',
data: avgBugs,
backgroundColor: 'rgba(244, 63, 94, 0.7)'
},
{
label: 'Avg Deployments',
data: avgDeploy,
backgroundColor: 'rgba(34, 197, 94, 0.7)'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { labels: { color: '#d1d5db' } }
},
scales: {
x: { ticks: { color: '#9ca3af' }, grid: { color: 'rgba(255,255,255,0.05)' } },
y: { ticks: { color: '#9ca3af' }, grid: { color: 'rgba(255,255,255,0.05)' } }
}
}
});
}
function refreshData() {
// Regenerate data and re-init charts
initCharts();
}
// On load
window.addEventListener('load', initCharts);
</script>
That should cover it. Let's check:
- Dark theme with light text.
- Uses Inter and Playfair Display (display).
- Grain overlay effect.
- Glassmorphism cards.
- Three KPI cards.
- Combined line chart with gradient fills and two y-axes.
- Scatter plot showing correlation between deployments and bugs, with color representing design throughput.
- Bar chart with monthly averages.
- Refresh button to simulate new data.
- Responsive with Tailwind grid.
The code is standalone, using CDN for Tailwind and Chart.js. No other dependencies.
Ensure we have the correct color codes: teal-400 is #2dd4bf? Actually teal-400 is #2dd4bf. I used #14b8a6 (teal-500). Suggest using teal-500 for a bit more brightness? But it's fine.
I used #06b6d4 (cyan-500) for high design in scatter. Could adjust.
Also, the scatter point color mapping: from design low (10) to high (30) maps from red to cyan. That's intuitive: high design review reduces bugs? Actually bug escapes likely decrease with higher design reviews. The scatter might show that points with high design are lower bug counts? But the simulation model: bugs = 0.05 * deploy * (30 - design). So higher design reduces bugs. So indeed red points (low design) would have higher bug count on average, cyan points lower. Good.
Let's also include the correlation coefficient? Maybe we can compute and display it. I'll add a text below scatter: "Correlation (Deploy vs Bugs): r = X.XX" and show p-value? But it's synthetic. Could compute quickly.
But the bar chart already shows averages.
I think it's sufficient.
However, the user said "Engineer a team dashboard that correlates design review throughput, bug escapes, and deployment frequency." I've shown correlation via scatter plot and also combined line chart (looking at trends). Also month averages could show patterns.
I'll add a small computed correlation coefficient text near the scatter chart title.
Let's modify: after creating scatterChart, compute Pearson r between deploy and bug.
I'll add:
function pearsonCorrelation(x, y) { ... }
then:
const r = pearsonCorrelation(chartData.deployData, chartData.bugData);
document.getElementById('scatterCorr').textContent = Correlation coefficient: ${r.toFixed(2)};
Add an element with id scatterCorr.
Let's do that for the scatter section.
Also, maybe add a note about the direction of correlation.
I'll adjust.
Another: The design review throughput in scatter is shown by color; we could also compute a 3D correlation. But okay.
Let's update the HTML:
In the scatter card, after title, add:
Then in initCharts after scatterChart creation, compute and set.
Also, I could compute correlation between design and bugs, or design and deploy. But just one.
I'll also add a similar metric for correlation between design and bugs maybe as another small card? But the bar chart shows averages; not correlation.
Perhaps use a correlation matrix heatmap? That would be nicer but more complex. I'll stick with the scatter and the displayed r.
Implement:
function pearson(x, y) {
const n = x.length;
const sumX = x.reduce((a,b)=>a+b,0);
const sumY = y.reduce((a,b)=>a+b,0);
const sumXY = x.reduce((s, xi, i) => s + xiy[i], 0);
const sumX2 = x.reduce((s, xi) => s + xixi, 0);
const sumY2 = y.reduce((s, yi) => s + yiyi, 0);
const num = nsumXY - sumXsumY;
const den = Math.sqrt(nsumX2 - sumXsumX) * Math.sqrt(nsumY2 - sumY*sumY);
return den === 0 ? 0 : num/den;
}
Set text.
Also, maybe compute correlation between design and bugs and show in KPI? Not necessary.
I'll also add a small message that the correlation is negative? The model suggests negative correlation between design and bugs? Actually we are correlating deploy vs bugs, and color shows design. So I'll just show the r.
That's fine.
I should also consider that Chart.js type 'line' with fill will create area charts. I used gradient fill. Good.
Add a smooth curve with tension: 0.4.
That's done.
Let's write final code with modifications.
I also need to ensure the font families set correctly: For non-serif, it's Inter by default. For serif (Playfair Display), I set h1-h6 family to Playfair Display. That's good.
Check that the grain overlay has high z-index but not interfering with clicks: pointer-events none.
Now, implement correlation display.
Also, maybe the scatter chart tooltips show values.
I'll add ID and update.
In the scatter card:
Better.
Then in initCharts, after creating scatterChart, compute and set.
I'll do that.
Also, I need to recompute when refreshData is called.
I'll update the scatterCorr element every time.
All good.
Let's produce final code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Team Dashboard - Design, Bugs, Deployments</title>
<!-- Tailwind CSS via CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Chart.js for visualizations -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- Google Fonts: Inter and Playfair Display -->
<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@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #0a0a0a;
color: #f0f0f0;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Playfair Display', serif;
}
/* Subtle grain overlay for texture */
.grain-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none;
z-index: 9999;
opacity: 0.05;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* Glassmorphism card */
.glass-card {
background: rgba(255,255,255,0.03);
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 1rem;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glass-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
border-color: rgba(255,255,255,0.2);
}
.chart-container {
position: relative;
height: 300px;
width: 100%;
}
</style>
</head>
<body class="antialiased">
<!-- Grain overlay -->
<div class="grain-overlay"></div>
<!-- Navigation -->
<nav class="border-b border-gray-800 bg-gray-900/50 backdrop-blur-sm sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<div class="flex items-center gap-3">
<div class="w-8 h-8 rounded-lg bg-gradient-to-br from-teal-400 to-blue-600 flex items-center justify-center text-white font-bold text-sm">D</div>
<span class="font-display text-xl font-bold tracking-tight">Team Insight</span>
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<a href="#" class="text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Dashboard</a>
<a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Reports</a>
<a href="#" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium focus:outline-none">Settings</a>
</div>
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-white mb-2">Engineering Dashboard</h1>
<p class="text-gray-400">Correlating design review throughput, bug escapes, and deployment frequency.</p>
</div>
<!-- KPI Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<!-- Design Review Throughput -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Design Reviews</h3>
<svg class="w-5 h-5 text-teal-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-design" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Completed design reviews per week.</p>
</div>
<!-- Bug Escapes -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Bug Escapes</h3>
<svg class="w-5 h-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-bugs" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Bugs discovered in production.</p>
</div>
<!-- Deployment Frequency -->
<div class="glass-card p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-400 uppercase tracking-wider">Deployments</h3>
<svg class="w-5 h-5 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
</div>
<div class="flex items-baseline">
<span id="kpi-deploy" class="text-3xl font-bold text-white">--</span>
<span class="ml-2 text-sm text-gray-500">this week</span>
</div>
<p class="mt-2 text-sm text-gray-500">Number of deployments to production.</p>
</div>
</div>
<!-- Trend Chart -->
<div class="glass-card p-6 mb-8">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold text-white">Trends Over Time</h2>
<button onclick="refreshData()" class="px-3 py-1 text-xs bg-gray-800 hover:bg-gray-700 text-gray-300 rounded-full border border-gray-600 transition">Simulate new data</button>
</div>
<div class="chart-container">
<canvas id="trendChart"></canvas>
</div>
</div>
<!-- Detailed Correlations -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8">
<!-- Scatter Plot -->
<div class="glass-card p-6">
<h2 class="text-xl font-bold text-white mb-2">Bug Escapes vs Deployment Frequency</h2>
<p class="text-gray-400 text-sm mb-4">Each point represents a week. Color intensity indicates design review throughput.</p>
<div class="flex justify-end mb-2">
<span class="text-sm font-mono text-teal-400" id="scatterCorr"></span>
</div>
<div class="chart-container">
<canvas id="scatterChart"></canvas>
</div>
</div>
<!-- Monthly Averages -->
<div class="glass-card p-6">
<h2 class="text-xl font-bold text-white mb-4">Monthly Average Metrics</h2>
<div class="chart-container">
<canvas id="correlationBarChart"></canvas>
</div>
</div>
</div>
<footer class="text-center text-gray-500 text-sm py-6 border-t border-gray-800">
<p>Data updates automatically every hour. Last updated: <span id="lastUpdated">--</span></p>
</footer>
</main>
<script>
// Generate synthetic data for the past 12 weeks
function generateData() {
const weeks = 12;
const labels = [];
const designData = [];
const bugData = [];
const deployData = [];
for (let i = weeks - 1; i >= 0; i--) {
const date = new Date();
date.setDate(date.getDate() - i * 7);
labels.push(date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }));
// Design review throughput: 10-30 per week
const design = Math.floor(Math.random() * 20) + 10;
// Deployment frequency: 5-20 per week
const deploy = Math.floor(Math.random() * 15) + 5;
// Bug escapes: influenced by both deployments and design reviews;
// More deployments increase chances, more design reviews reduce them.
let bugs = Math.floor(0.05 * deploy * (30 - design) + Math.random() * 3);
if (bugs < 0) bugs = 0;
designData.push(design);
bugData.push(bugs);
deployData.push(deploy);
}
return { labels, designData, bugData, deployData };
}
// Pearson correlation coefficient
function pearsonCorr(x, y) {
const n = x.length;
const sumX = x.reduce((a, b) => a + b, 0);
const sumY = y.reduce((a, b) => a + b, 0);
const sumXY = x.reduce((total, xi, i) => total + xi * y[i], 0);
const sumX2 = x.reduce((total, xi) => total + xi * xi, 0);
const sumY2 = y.reduce((total, yi) => total + yi * yi, 0);
const num = n * sumXY - sumX * sumY;
const den = Math.sqrt(n * sumX2 - sumX * sumX) * Math.sqrt(n * sumY2 - sumY * sumY);
return den === 0 ? 0 : num / den;
}
let trendChart, scatterChart, correlationBarChart;
let chartData;
function initCharts() {
chartData = generateData();
// Update KPI cards with last week's values
const latestIdx = chartData.labels.length - 1;
document.getElementById('kpi-design').textContent = chartData.designData[latestIdx];
document.getElementById('kpi-bugs').textContent = chartData.bugData[latestIdx];
document.getElementById('kpi-deploy').textContent = chartData.deployData[latestIdx];
document.getElementById('lastUpdated').textContent = new Date().toLocaleTimeString();
// --- 1. Trend Line Chart (Two Y-Axes) ---
const ctxTrend = document.getElementById('trendChart').getContext('2d');
// Gradients for fill
const gradDesign = ctxTrend.createLinearGradient(0, 0, 0, 400);
gradDesign.addColorStop(0, 'rgba(20, 184, 166, 0.5)');
gradDesign.addColorStop(1, 'rgba(20, 184, 166, 0.0)');
const gradBugs = ctxTrend.createLinearGradient(0, 0, 0, 400);
gradBugs.addColorStop(0, 'rgba(244, 63, 94, 0.5)');
gradBugs.addColorStop(1, 'rgba(244, 63, 94, 0.0)');
const gradDeploy = ctxTrend.createLinearGradient(0, 0, 0, 400);
gradDeploy.addColorStop(0, 'rgba(34, 197, 94, 0.5)');
gradDeploy.addColorStop(1, 'rgba(34, 197, 94, 0.0)');
if (trendChart) trendChart.destroy();
trendChart = new Chart(ctxTrend, {
type: 'line',
data: {
labels: chartData.labels,
datasets: [
{
label: 'Design Reviews',
data: chartData.designData,
borderColor: '#14b8a6',
backgroundColor: gradDesign,
fill: true,
tension: 0.4,
yAxisID: 'y'
},
{
label: 'Bug Escapes',
data: chartData.bugData,
borderColor: '#f43f5e',
backgroundColor: gradBugs,
fill: true,
tension: 0.4,
yAxisID: 'y'
},
{
label: 'Deployments',
data: chartData.deployData,
borderColor: '#22c55e',
backgroundColor: gradDeploy,
fill: true,
tension: 0.4,
yAxisID: 'y1'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
interaction: { mode: 'index', intersect: false },
plugins: {
legend: { labels: { color: '#d1d5db' } }
},
scales: {
x: {
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
},
y: {
type: 'linear',
display: true,
position: 'left',
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' },
title: { display: true, text: 'Count (Design & Bugs)', color: '#6b7280' }
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: { color: '#9ca3af' },
grid: { drawOnChartArea: false },
title: { display: true, text: 'Deployments', color: '#6b7280' }
}
}
}
});
// --- 2. Scatter Plot: Deployments vs Bugs, colored by Design Reviews ---
const ctxScatter = document.getElementById('scatterChart').getContext('2d');
if (scatterChart) scatterChart.destroy();
const scatterPoints = chartData.labels.map((label, i) => ({
x: chartData.deployData[i],
y: chartData.bugData[i],
design: chartData.designData[i]
}));
scatterChart = new Chart(ctxScatter, {
type: 'scatter',
data: {
datasets: [{
label: 'Weekly',
data: scatterPoints,
backgroundColor: scatterPoints.map(p => {
// Map design value (10-30) to a color gradient: red (low) -> cyan (high)
const min = 10, max = 30;
const ratio = (p.design - min) / (max - min);
const r = Math.round(244 + (6 - 244) * ratio);
const g = Math.round(63 + (182 - 63) * ratio);
const b = Math.round(94 + (212 - 94) * ratio);
return `rgba(${r}, ${g}, ${b}, 0.8)`;
}),
pointRadius: 8,
pointHoverRadius: 10
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { display: false },
tooltip: {
callbacks: {
label: function(context) {
const p = context.raw;
return `Deploy: ${p.x}, Bugs: ${p.y}, Design: ${p.design}`;
}
}
}
},
scales: {
x: {
title: { display: true, text: 'Deployment Frequency', color: '#d1d5db' },
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
},
y: {
title: { display: true, text: 'Bug Escapes', color: '#d1d5db' },
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
}
}
}
});
// Display Pearson correlation between deployments and bugs
const r = pearsonCorr(chartData.deployData, chartData.bugData);
document.getElementById('scatterCorr').innerHTML =
`Correlation (Deployments vs. Bugs): <span class="${r < 0 ? 'text-red-400' : 'text-green-400'}">${r.toFixed(2)}</span>`;
// --- 3. Monthly Averages Bar Chart ---
const ctxBar = document.getElementById('correlationBarChart').getContext('2d');
if (correlationBarChart) correlationBarChart.destroy();
// Compute averages per 4-week month
const months = ['Month 1', 'Month 2', 'Month 3'];
const avgDesign = [], avgBugs = [], avgDeploy = [];
for (let m = 0; m < 3; m++) {
let sumDesign = 0, sumBugs = 0, sumDeploy = 0, count = 0;
for (let i = m * 4; i < Math.min((m+1)*4, chartData.labels.length); i++) {
sumDesign += chartData.designData[i];
sumBugs += chartData.bugData[i];
sumDeploy += chartData.deployData[i];
count++;
}
avgDesign.push((sumDesign / count).toFixed(1));
avgBugs.push((sumBugs / count).toFixed(1));
avgDeploy.push((sumDeploy / count).toFixed(1));
}
correlationBarChart = new Chart(ctxBar, {
type: 'bar',
data: {
labels: months,
datasets: [
{
label: 'Design Reviews',
data: avgDesign,
backgroundColor: 'rgba(20, 184, 166, 0.7)'
},
{
label: 'Bug Escapes',
data: avgBugs,
backgroundColor: 'rgba(244, 63, 94, 0.7)'
},
{
label: 'Deployments',
data: avgDeploy,
backgroundColor: 'rgba(34, 197, 94, 0.7)'
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { labels: { color: '#d1d5db' } }
},
scales: {
x: {
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
},
y: {
ticks: { color: '#9ca3af' },
grid: { color: 'rgba(255,255,255,0.05)' }
}
}
}
});
}
function refreshData() {
initCharts();
}
// Initialize on load
window.addEventListener('load', initCharts);
</script>
</body>
</html>