Algorithm-TimelinePacking

 view release on metacpan or  search on metacpan

examples/hadoop-jobs.html  view on Meta::CPAN

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Hadoop Jobs Timeline - Demo</title>
    <script src="https://d3js.org/d3.v7.min.js"></script>
    <style>
        * { box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            margin: 0; padding: 20px; background: #f8f9fa; color: #333;
        }
        h1 { margin-top: 0; color: #2c3e50; }
        .subtitle { color: #666; margin-bottom: 20px; }
        .container { max-width: 1400px; margin: 0 auto; }
        #chart {
            background: #fff; border-radius: 8px; padding: 20px;
            overflow-x: auto; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        svg { overflow: visible; }
        rect {
            stroke: rgba(0,0,0,0.1); stroke-width: 0.5;
            cursor: pointer; transition: opacity 0.2s;
        }
        rect:hover { stroke: #333; stroke-width: 2; opacity: 0.85; }
        .stats { margin-top: 15px; font-size: 13px; color: #666; }
        .tooltip {
            position: absolute; background: rgba(0,0,0,0.9); color: #fff;
            padding: 10px; border-radius: 4px; font-size: 12px;
            pointer-events: none; z-index: 1000; line-height: 1.5; display: none;
        }
        .tooltip-title { font-weight: bold; margin-bottom: 5px; }
        .legend { display: flex; gap: 20px; margin-top: 15px; font-size: 12px; }
        .legend-item { display: flex; align-items: center; gap: 5px; }
        .legend-color { width: 20px; height: 12px; border-radius: 2px; }
    </style>
</head>
<body>
    <div class="container">
        <h1>Hadoop MapReduce Timeline</h1>
        <p class="subtitle">75 jobs arranged into parallel execution lanes. Color intensity indicates map task count. Hover for details.</p>

        <div id="chart">
            <svg id="timeline" width="1200"></svg>
        </div>

        <div class="legend">
            <div class="legend-item">
                <div class="legend-color" id="legend-low"></div>
                <span>Few map tasks</span>
            </div>
            <div class="legend-item">
                <div class="legend-color" id="legend-high"></div>
                <span>Many map tasks</span>
            </div>
        </div>

        <div class="stats" id="stats"></div>
    </div>

    <div class="tooltip" id="tooltip">
        <div class="tooltip-title" id="tooltip-title"></div>
        <div id="tooltip-user"></div>
        <div id="tooltip-maps"></div>
        <div id="tooltip-reduces"></div>
        <div id="tooltip-duration"></div>
    </div>

<script>
// =============================================================================
// INPUT: Raw job data (sent to server)
// Each job: [start_epoch, end_epoch, job_id, user, map_tasks, reduce_tasks]
// =============================================================================
var INPUT = [[1700002680,1700002812,"job_1","alice",2121,41],[1700003083,1700003262,"job_2","dave",3464,418],[1700001666,1700001869,"job_3","dave",139,385],[1700002164,1700002466,"job_4","dave",2689,249],[1700001575,1700001709,"job_5","grace",311,430...

// =============================================================================
// OUTPUT: Pre-computed by Algorithm::TimelinePacking (returned from server)
// Times normalized to start at 0, arranged into non-overlapping lines
// =============================================================================
var EARLIEST = 1700000030;  // Original start timestamp
var LATEST = 3753;          // Duration in seconds

var lines = [



( run in 3.819 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )