The user wants a dataset version diff explorer - this is a data science/ML tool that compares different versions of datasets. Let me think about what this should include:
- Schema Changes: Changes in column names, data types, added/removed columns
- Distribution Shifts: Changes in data distribution (histograms, statistics)
- Annotation Updates: Changes in labels, annotations added/removed/modified
I need to create an interactive, visually appealing single-file HTML page with:
- A dashboard-style layout
- Multiple panels showing different aspects of the diff
- Interactive elements (hover effects, animations, maybe tabs)
- At least 3 dynamic elements (particles, animations, transitions)
Design considerations:
- Professional, technical aesthetic - not the typical blue-purple gradient
- Dark theme would work well for a data tool
- Use accent colors for highlighting changes (green for additions, red for deletions, yellow for modifications)
- Clean, modern typography
Features to include:
- Version selector (v1.0 vs v2.0 comparison)
- Schema diff panel showing column changes
- Distribution comparison with animated charts
- Annotation changes timeline or list
- Summary statistics cards
- Maybe a visual graph/network showing relationships
Interactive elements:
- Animated particles in background (subtle, professional)
- Hover effects on cards and items
- Tab switching with smooth transitions
- Animated progress bars
- Pulsing indicators for changes
- Scroll-triggered animations
Let me build this out with a sophisticated, data-focused design.
Color scheme:
- Dark background (#0a0f1c or similar dark blue-black)
- Accent green (#10b981) for additions
- Accent red (#ef4444) for deletions
- Accent amber (#f59e0b) for modifications
- Clean white/light gray text
- Subtle borders and cards
I'll create mock data for the comparison between two dataset versions.
Dataset Version Diff Explorer
This is a sophisticated data science tool for comparing dataset versions. Here's my approach:
Key Features:
- Schema Changes Panel - Visual diff of column additions, removals, and type changes
- Distribution Shifts - Animated histograms and statistical drift detection
- Annotation Updates - Timeline of label changes with filtering
- Interactive Elements - Particle background, animated charts, hover effects, tab navigation
Design Choices:
- Dark technical theme with high contrast
- Color-coded change indicators (green=add, red=remove, amber=modify)
- Animated statistics with counting effects
- Smooth transitions throughout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dataset Version Diff Explorer</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg-primary: #0a0f1c;
--bg-secondary: #111827;
--bg-card: #1a2234;
--border-color: #2d3748;
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--accent-green: #10b981;
--accent-red: #ef4444;
--accent-amber: #f59e0b;
--accent-blue: #3b82f6;
--accent-purple: #8b5cf6;
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
overflow-x: hidden;
}
#particle-canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
}
.app-container {
position: relative;
z-index: 1;
max-width: 1600px;
margin: 0 auto;
padding: 20px;
}
/* Header */
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 30px;
background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
border-radius: 16px;
border: 1px solid var(--border-color);
margin-bottom: 24px;
}
.header h1 {
font-size: 1.8rem;
font-weight: 700;
background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.version-selector {
display: flex;
align-items: center;
gap: 16px;
}
.version-badge {
padding: 10px 20px;
background: var(--bg-primary);
border: 2px solid var(--border-color);
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.version-badge::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
transition: left 0.5s ease;
}
.version-badge:hover::before {
left: 100%;
}
.version-badge.active {
border-color: var(--accent-blue);
box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}
.version-badge.old {
color: var(--text-secondary);
}
.version-badge.new {
color: var(--accent-green);
}
.diff-arrow {
font-size: 1.5rem;
color: var(--accent-amber);
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.7; transform: scale(1.1); }
}
/* Stats Cards */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 20px;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.stat-card:hover {
transform: translateY(-4px);
border-color: var(--accent-blue);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.stat-card::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 3px;
background: var(--card-accent, var(--accent-blue));
}
.stat-card.additions { --card-accent: var(--accent-green); }
.stat-card.deletions { --card-accent: var(--accent-red); }
.stat-card.modifications { --card-accent: var(--accent-amber); }
.stat-card.drift { --card-accent: var(--accent-purple); }
.stat-label {
font-size: 0.85rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 8px;
}
.stat-value {
font-size: 2.5rem;
font-weight: 700;
color: var(--text-primary);
}
.stat-change {
display: flex;
align-items: center;
gap: 4px;
margin-top: 8px;
font-size: 0.9rem;
}
.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-red); }
/* Main Content */
.main-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 24px;
}
@media (max-width: 1200px) {
.main-content {
grid-template-columns: 1fr;
}
}
.panel {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: 16px;
overflow: hidden;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 24px;
border-bottom: 1px solid var(--border-color);
background: var(--bg-secondary);
}
.panel-title {
font-size: 1.1rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 10px;
}
.panel-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1rem;
}
.panel-icon.schema { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.panel-icon.distribution { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }
.panel-icon.annotation { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.panel-tabs {
display: flex;
gap: 4px;
}
.panel-tab {
padding: 8px 16px;
background: transparent;
border: none;
color: var(--text-muted);
cursor: pointer;
border-radius: 6px;
transition: all 0.3s ease;
font-size: 0.85rem;
}
.panel-tab:hover {
color: var(--text-secondary);
background: rgba(255, 255, 255, 0.05);
}
.panel-tab.active {
color: var(--text-primary);
background: var(--accent-blue);
}
.panel-content {
padding: 20px 24px;
max-height: 400px;
overflow-y: auto;
}
.panel-content::-webkit-scrollbar {
width: 6px;
}
.panel-content::-webkit-scrollbar-track {
background: var(--bg-primary);
}
.panel-content::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 3px;
}
/* Schema Changes */
.schema-item {
display: flex;
align-items: center;
padding: 14px 16px;
background: var(--bg-secondary);
border-radius: 10px;
margin-bottom: 10px;
border-left: 3px solid transparent;
transition: all 0.3s ease;
animation: slideIn 0.4s ease forwards;
opacity: 0;
transform: translateX(-20px);
}
@keyframes slideIn {
to {
opacity: 1;
transform: translateX(0);
}
}
.schema-item:hover {
background: rgba(255, 255, 255, 0.05);
transform: translateX(4px);
}
.schema-item.added { border-left-color: var(--accent-green); }
.schema-item.removed { border-left-color: var(--accent-red); }
.schema-item.modified { border-left-color: var(--accent-amber); }
.schema-item.unchanged { border-left-color: var(--text-muted); }
.schema-status {
width: 28px;
height: 28px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 14px;
font-size: 0.8rem;
font-weight: 700;
}
.schema-item.added .schema-status { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.schema-item.removed .schema-status { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.schema-item.modified .schema-status { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.schema-item.unchanged .schema-status { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }
.schema-info {
flex: 1;
}
.schema-name {
font-weight: 600;
margin-bottom: 4px;
font-family: 'Consolas', monospace;
}
.schema-type {
font-size: 0.8rem;
color: var(--text-muted);
}
.schema-type-change {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.85rem;
}
.type-old {
color: var(--accent-red);
text-decoration: line-through;
}
.type-new {
color: var(--accent-green);
}
/* Distribution Charts */
.chart-container {
margin-bottom: 24px;
}
.chart-title {
font-size: 0.9rem;
color: var(--text-secondary);
margin-bottom: 12px;
display: flex;
align-items: center;
justify-content: space-between;
}
.drift-score {
padding: 4px 10px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
}
.drift-score.low { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.drift-score.medium { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.drift-score.high { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.histogram {
display: flex;
align-items: flex-end;
gap: 4px;
height: 100px;
padding: 10px 0;
}
.histogram-bar {
flex: 1;
border-radius: 3px 3px 0 0;
position: relative;
transition: all 0.3s ease;
cursor: pointer;
}
.histogram-bar:hover {
filter: brightness(1.2);
}
.histogram-bar.v1 {
background: linear-gradient(180deg, var(--accent-blue), rgba(59, 130, 246, 0.3));
}
.histogram-bar.v2 {
background: linear-gradient(180deg, var(--accent-green), rgba(16, 185, 129, 0.3));
}
.histogram-bar::after {
content: attr(data-value);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
font-size: 0.7rem;
color: var(--text-muted);
opacity: 0;
transition: opacity 0.3s;
white-space: nowrap;
}
.histogram-bar:hover::after {
opacity: 1;
}
.chart-legend {
display: flex;
justify-content: center;
gap: 24px;
margin-top: 12px;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.8rem;
color: var(--text-secondary);
}
.legend-dot {
width: 10px;
height: 10px;
border-radius: 50%;
}
.legend-dot.v1 { background: var(--accent-blue); }
.legend-dot.v2 { background: var(--accent-green); }
/* Annotation Timeline */
.timeline {
position: relative;
padding-left: 30px;
}
.timeline::before {
content: '';
position: absolute;
left: 8px;
top: 0;
bottom: 0;
width: 2px;
background: linear-gradient(180deg, var(--accent-amber), var(--accent-purple), var(--accent-blue));
}
.timeline-item {
position: relative;
padding: 16px 20px;
background: var(--bg-secondary);
border-radius: 10px;
margin-bottom: 16px;
animation: fadeInUp 0.5s ease forwards;
opacity: 0;
transition: all 0.3s ease;
}
.timeline-item:hover {
background: rgba(255, 255, 255, 0.05);
transform: translateX(4px);
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.timeline-dot {
position: absolute;
left: -26px;
top: 20px;
width: 14px;
height: 14px;
border-radius: 50%;
border: 3px solid var(--bg-card);
}
.timeline-item.label-added .timeline-dot { background: var(--accent-green); }
.timeline-item.label-removed .timeline-dot { background: var(--accent-red); }
.timeline-item.label-modified .timeline-dot { background: var(--accent-amber); }
.timeline-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.timeline-action {
font-weight: 600;
font-size: 0.9rem;
}
.timeline-item.label-added .timeline-action { color: var(--accent-green); }
.timeline-item.label-removed .timeline-action { color: var(--accent-red); }
.timeline-item.label-modified .timeline-action { color: var(--accent-amber); }
.timeline-time {
font-size: 0.75rem;
color: var(--text-muted);
}
.timeline-details {
font-size: 0.85rem;
color: var(--text-secondary);
}
.timeline-meta {
display: flex;
gap: 16px;
margin-top: 10px;
font-size: 0.75rem;
color: var(--text-muted);
}
/* Dual Histogram */
.dual-histogram {
display: flex;
align-items: flex-end;
gap: 2px;
height: 120px;
}
.dual-bar-group {
flex: 1;
display: flex;
flex-direction: column;
gap: 2px;
}
.dual-bar {
height: var(--height);
border-radius: 2px;
transition: all 0.3s ease;
}
.dual-bar.top {
background: var(--accent-blue);
opacity: 0.7;
}
.dual-bar.bottom {
background: var(--accent-green);
opacity: 0.7;
}
/* Filter Pills */
.filter-pills {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.filter-pill {
padding: 6px 14px;
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 0.8rem;
color: var(--text-muted);
cursor: pointer;
transition: all 0.3s ease;
}
.filter-pill:hover {
border-color: var(--accent-blue);
color: var(--text-secondary);
}
.filter-pill.active {
background: var(--accent-blue);
border-color: var(--accent-blue);
color: white;
}
/* Summary Box */
.summary-box {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
border: 1px solid rgba(59, 130, 246, 0.3);
border-radius: 12px;
padding: 20px;
margin-top: 16px;
}
.summary-title {
font-weight: 600;
margin-bottom: 12px;
color: var(--text-primary);
}
.summary-stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.summary-stat {
text-align: center;
}
.summary-stat-value {
font-size: 1.4rem;
font-weight: 700;
}
.summary-stat-label {
font-size: 0.75rem;
color: var(--text-muted);
margin-top: 4px;
}
/* Animation for stat values */
.animate-count {
transition: all 0.5s ease;
}
/* Loading shimmer */
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.shimmer {
background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
}
</style>
</head>
<body>
<canvas id="particle-canvas"></canvas>
<div class="app-container">
<header class="header">
<h1>Dataset Version Diff Explorer</h1>
<div class="version-selector">
<div class="version-badge old active" onclick="selectVersion(this, 'old')">v1.0.0</div>
<span class="diff-arrow">→</span>
<div class="version-badge new active" onclick="selectVersion(this, 'new')">v2.0.0</div>
</div>
</header>
<div class="stats-grid">
<div class="stat-card additions">
<div class="stat-label">Schema Additions</div>
<div class="stat-value animate-count" data-target="12">0</div>
<div class="stat-change positive">
<span>↑</span> New columns added
</div>
</div>
<div class="stat-card deletions">
<div class="stat-label">Schema Deletions</div>
<div class="stat-value animate-count" data-target="4">0</div>
<div class="stat-change negative">
<span>↓</span> Columns removed
</div>
</div>
<div class="stat-card modifications">
<div class="stat-label">Annotation Updates</div>
<div class="stat-value animate-count" data-target="847">0</div>
<div class="stat-change positive">
<span>↑</span> Labels refined
</div>
</div>
<div class="stat-card drift">
<div class="stat-label">Distribution Drift</div>
<div class="stat-value animate-count" data-target="23" data-suffix="%">0%</div>
<div class="stat-change negative">
<span>!</span> Moderate shift detected
</div>
</div>
</div>
<div class="main-content">
<!-- Schema Changes Panel -->
<div class="panel">
<div class="panel-header">
<div class="panel-title">
<div class="panel-icon schema">◇</div>
Schema Changes
</div>
<div class="panel-tabs">
<button class="panel-tab active" onclick="filterSchema('all', this)">All</button>
<button class="panel-tab" onclick="filterSchema('added', this)">Added</button>
<button class="panel-tab" onclick="filterSchema('removed', this)">Removed</button>
<button class="panel-tab" onclick="filterSchema('modified', this)">Modified</button>
</div>
</div>
<div class="panel-content" id="schema-content">
<!-- Schema items will be injected here -->
</div>
</div>
<!-- Distribution Shifts Panel -->
<div class="panel">
<div class="panel-header">
<div class="panel-title">
<div class="panel-icon distribution">◈</div>
Distribution Shifts
</div>
<div class="panel-tabs">
<button class="panel-tab active" onclick="showDistribution('numeric', this)">Numeric</button>
<button class="panel-tab" onclick="showDistribution('categorical', this)">Categorical</button>
</div>
</div>
<div class="panel-content" id="distribution-content">
<!-- Distribution charts will be injected here -->
</div>
</div>
<!-- Annotation Updates Panel -->
<div class="panel" style="grid-column: span 2;">
<div class="panel-header">
<div class="panel-title">
<div class="panel-icon annotation">◆</div>
Annotation Updates
</div>
<div class="filter-pills">
<span class="filter-pill active" onclick="filterAnnotations('all', this)">All</span>
<span class="filter-pill" onclick="filterAnnotations('added', this)">Added</span>
<span class="filter-pill" onclick="filterAnnotations('modified', this)">Modified</span>
<span class="filter-pill" onclick="filterAnnotations('removed', this)">Removed</span>
</div>
</div>
<div class="panel-content">
<div class="timeline" id="annotation-timeline">
<!-- Timeline items will be injected here -->
</div>
<div class="summary-box">
<div class="summary-title">Annotation Summary</div>
<div class="summary-stats">
<div class="summary-stat">
<div class="summary-stat-value" style="color: var(--accent-green);">+324</div>
<div class="summary-stat-label">New Labels</div>
</div>
<div class="summary-stat">
<div class="summary-stat-value" style="color: var(--accent-amber);">~523</div>
<div class="summary-stat-label">Modified</div>
</div>
<div class="summary-stat">
<div class="summary-stat-value" style="color: var(--accent-red);">-89</div>
<div class="summary-stat-label">Removed</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Data definitions
const schemaChanges = [
{ name: 'user_id', status: 'unchanged', type: 'STRING', oldType: null },
{ name: 'session_duration', status: 'modified', type: 'FLOAT', oldType: 'INT' },
{ name: 'page_views', status: 'added', type: 'INT', oldType: null },
{ name: 'bounce_rate', status: 'added', type: 'FLOAT', oldType: null },
{ name: 'conversion_flag', status: 'removed', type: 'BOOLEAN', oldType: null },
{ name: 'user_segment', status: 'modified', type: 'ENUM', oldType: 'STRING' },
{ name: 'device_type', status: 'added', type: 'STRING', oldType: null },
{ name: 'geo_region', status: 'unchanged', type: 'STRING', oldType: null },
{ name: 'timestamp', status: 'modified', type: 'TIMESTAMP', oldType: 'DATETIME' },
{ name: 'legacy_field', status: 'removed', type: 'STRING', oldType: null },
{ name: 'engagement_score', status: 'added', type: 'FLOAT', oldType: null },
{ name: 'cohort_id', status: 'added', type: 'INT', oldType: null },
{ name: 'attribution_source', status: 'added', type: 'STRING', oldType: null },
{ name: 'old_metric', status: 'removed', type: 'INT', oldType: null },
{ name: 'revenue_estimate', status: 'added', type: 'DECIMAL', oldType: null },
{ name: 'lifetime_value', status: 'added', type: 'DECIMAL', oldType: null },
];
const distributionData = {
numeric: [
{
name: 'Session Duration (min)',
driftScore: 0.12,
driftLevel: 'low',
v1: [15, 25, 35, 45, 30, 20, 10, 5],
v2: [12, 28, 40, 42, 32, 22, 12, 6]
},
{
name: 'Page Views',
driftScore: 0.34,
driftLevel: 'medium',
v1: [45, 35, 25, 18, 12, 8, 5, 2],
v2: [30, 38, 32, 22, 15, 10, 6, 3]
}
],
categorical: [
{
name: 'User Segment',
driftScore: 0.28,
driftLevel: 'medium',
v1: [35, 28, 22, 15],
v2: [30, 32, 25, 13],
labels: ['Premium', 'Standard', 'Basic', 'Free']
}
]
};
const annotationUpdates = [
{ action: 'added', label: 'spam_detection', details: 'New binary classification label for spam content detection', time: '2 hours ago', user: 'ML Team', samples: 15000 },
{ action: 'modified', label: 'sentiment_score', details: 'Changed from 3-class to 5-class sentiment granularity', time: '5 hours ago', user: 'Annotation Lead', samples: 45000 },
{ action: 'added', label: 'entity_extraction', details: 'NER labels for person, organization, location entities', time: '1 day ago', user: 'NLP Team', samples: 28000 },
{ action: 'removed', label: 'legacy_category', details: 'Deprecated old category system in favor of new taxonomy', time: '2 days ago', user: 'Data Engineering', samples: 0 },
{ action: 'modified', label: 'intent_classification', details: 'Expanded intent taxonomy from 12 to 24 categories', time: '2 days ago', user: 'ML Team', samples: 52000 },
{ action: 'added', label: 'quality_score', details: 'Human-annotated quality rating on 1-5 scale', time: '3 days ago', user: 'QA Team', samples: 18000 },
{ action: 'removed', label: 'manual_review_flag', details: 'Automated review replaced manual flagging system', time: '4 days ago', user: 'Operations', samples: 0 },
{ action: 'modified', label: 'language_code', details: 'Updated to ISO 639-3 standard from ISO 639-1', time: '5 days ago', user: 'Localization', samples: 120000 },
];
// Particle system
const canvas = document.getElementById('particle-canvas');
const ctx = canvas.getContext('2d');
let particles = [];
let mouseX = 0, mouseY = 0;
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
class Particle {
constructor() {
this.reset();
}
reset() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.vx = (Math.random() - 0.5) * 0.5;
this.vy = (Math.random() - 0.5) * 0.5;
this.radius = Math.random() * 2 + 0.5;
this.opacity = Math.random() * 0.5 + 0.1;
this.hue = Math.random() * 60 + 200; // Blue to purple range
}
update() {
this.x += this.vx;
this.y += this.vy;
// Mouse interaction
const dx = mouseX - this.x;
const dy = mouseY - this.y;
const dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 150) {
const force = (150 - dist) / 150 * 0.02;
this.vx -= dx * force * 0.01;
this.vy -= dy * force * 0.01;
}
// Boundary check
if (this.x < 0 || this.x > canvas.width || this.y < 0 || this.y > canvas.height) {
this.reset();
}
// Speed limit
const speed = Math.sqrt(this.vx * this.vx + this.vy * this.vy);
if (speed > 1.5) {
this.vx *= 0.98;
this.vy *= 0.98;
}
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
ctx.fillStyle = `hsla(${this.hue}, 70%, 60%, ${this.opacity})`;
ctx.fill();
}
}
function initParticles() {
particles = [];
const count = Math.min(80, Math.floor((canvas.width * canvas.height) / 15000));
for (let i = 0; i < count; i++) {
particles.push(new Particle());
}
}
function drawConnections() {
for (let i = 0; i < particles.length; i++) {
for (let j = i + 1; j < particles.length; j++) {
const dx = particles[i].x - particles[j].x;
const dy = particles[i].y - particles[j].y;
const dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 120) {
ctx.beginPath();
ctx.moveTo(particles[i].x, particles[i].y);
ctx.lineTo(particles[j].x, particles[j].y);
ctx.strokeStyle = `rgba(59, 130, 246, ${0.1 * (1 - dist / 120)})`;
ctx.lineWidth = 0.5;
ctx.stroke();
}
}
}
}
function animateParticles() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach(p => {
p.update();
p.draw();
});
drawConnections();
requestAnimationFrame(animateParticles);
}
// Render functions
function renderSchemaItems(filter = 'all') {
const container = document.getElementById('schema-content');
const filtered = filter === 'all'
? schemaChanges
: schemaChanges.filter(item => item.status === filter);
container.innerHTML = filtered.map((item, index) => `
<div class="schema-item ${item.status}" style="animation-delay: ${index * 0.05}s">
<div class="schema-status">
${item.status === 'added' ? '+' : item.status === 'removed' ? '−' : item.status === 'modified' ? '↻' : '='}
</div>
<div class="schema-info">
<div class="schema-name">${item.name}</div>
${item.status === 'modified' ? `
<div class="schema-type-change">
<span class="type-old">${item.oldType}</span>
<span>→</span>
<span class="type-new">${item.type}</span>
</div>
` : `
<div class="schema-type">${item.type}</div>
`}
</div>
</div>
`).join('');
}
function renderDistributionCharts(type = 'numeric') {
const container = document.getElementById('distribution-content');
const data = distributionData[type];
container.innerHTML = data.map(chart => `
<div class="chart-container">
<div class="chart-title">
<span>${chart.name}</span>
<span class="drift-score ${chart.driftLevel}">
Drift: ${(chart.driftScore * 100).toFixed(0)}%
</span>
</div>
<div class="histogram">
${chart.v1.map((v1Val, i) => {
const v2Val = chart.v2[i];
const maxVal = Math.max(...chart.v1, ...chart.v2);
const h1 = (v1Val / maxVal) * 100;
const h2 = (v2Val / maxVal) * 100;
return `
<div class="dual-bar-group">
<div class="dual-bar top" style="--height: ${h1}px; height: ${h1}px;" data-value="v1: ${v1Val}"></div>
<div class="dual-bar bottom" style="--height: ${h2}px; height: ${h2}px;" data-value="v2: ${v2Val}"></div>
</div>
`;
}).join('')}
</div>
<div class="chart-legend">
<div class="legend-item">
<div class="legend-dot v1"></div>
<span>v1.0.0</span>
</div>
<div class="legend-item">
<div class="legend-dot v2"></div>
<span>v2.0.0</span>
</div>
</div>
${chart.labels ? `
<div style="display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.7rem; color: var(--text-muted);">
${chart.labels.map(l => `<span>${l}</span>`).join('')}
</div>
` : ''}
</div>
`).join('');
}
function renderAnnotationTimeline(filter = 'all') {
const container = document.getElementById('annotation-timeline');
const filtered = filter === 'all'
? annotationUpdates
: annotationUpdates.filter(item => item.action === filter);
container.innerHTML = filtered.map((item, index) => `
<div class="timeline-item label-${item.action}" style="animation-delay: ${index * 0.1}s">
<div class="timeline-dot"></div>
<div class="timeline-header">
<span class="timeline-action">
${item.action === 'added' ? 'Added' : item.action === 'removed' ? 'Removed' : 'Modified'}: ${item.label}
</span>
<span class="timeline-time">${item.time}</span>
</div>
<div class="timeline-details">${item.details}</div>
<div class="timeline-meta">
<span>By: ${item.user}</span>
<span>Samples: ${item.samples.toLocaleString()}</span>
</div>
</div>
`).join('');
}
// Animated counters
function animateCounters() {
document.querySelectorAll('.animate-count').forEach(el => {
const target = parseInt(el.dataset.target);
const suffix = el.dataset.suffix || '';
let current = 0;
const increment = target / 50;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
current = target;
clearInterval(timer);
}
el.textContent = Math.floor(current) + suffix;
}, 30);
});
}
// Event handlers
function filterSchema(filter, btn) {
document.querySelectorAll('.panel .panel-tab').forEach(t => t.classList.remove('active'));
if (btn) btn.classList.add('active');
renderSchemaItems(filter);
}
function showDistribution(type, btn) {
const parent = btn.closest('.panel');
parent.querySelectorAll('.panel-tab').forEach(t => t.classList.remove('active'));
btn.classList.add('active');
renderDistributionCharts(type);
}
function filterAnnotations(filter, btn) {
document.querySelectorAll('.filter-pill').forEach(p => p.classList.remove('active'));
btn.classList.add('active');
renderAnnotationTimeline(filter);
}
function selectVersion(el, type) {
el.classList.toggle('active');
}
// Initialize
window.addEventListener('load', () => {
resizeCanvas();
initParticles();
animateParticles();
renderSchemaItems();
renderDistributionCharts();
renderAnnotationTimeline();
setTimeout(animateCounters, 300);
});
window.addEventListener('resize', () => {
resizeCanvas();
initParticles();
});
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
});
</script>
</body>
</html>
Key Features Implemented:
1. Schema Changes Panel
- Color-coded items (green=added, red=removed, amber=modified)
- Type change visualization with strikethrough for old types
- Filterable tabs for each change type
- Animated entry effects
2. Distribution Shifts
- Dual histograms showing v1 vs v2 distributions
- Drift score indicators with severity levels
- Support for numeric and categorical data
- Interactive hover states showing values
3. Annotation Updates
- Timeline view with color-coded action dots
- Detailed metadata (user, time, sample count)
- Filter pills for quick filtering
- Summary statistics box
4. Interactive Elements
- Particle background with mouse interaction
- Animated counters for statistics
- Smooth transitions on all interactions
- Hover effects with subtle transforms
- Filter tabs for all panels