<commit_before>$(document).ready(function() {
    var downtime = JSON.parse($('#downtimegraph').text());
    $('#downtimegraph').text('');

    var flot_data = []
    var yaxis_bits = [];
    var min_date = downtime[0].start_time;
    var max_date = downtime[0].end_time;

    for (var i=0; i<downtime.length; i++) {
        var dt = downtime[i]
        flot_data.push({
            'label': dt.expr,
            'data': [
                new Date(dt.start_time * 1000),
                dt.key,
                new Date(dt.end_time * 1000),
                dt.expr,
            ],
        });
        yaxis_bits.push([i+1, dt.expr]);
        if (dt.start_time < min_date) {
            min_date = dt.start_time;
        }
        if (dt.max_time > max_date) {
            max_date = dt.end_time;
        }
    }
    min_date = new Date(min_date * 1000);
    max_date = new Date(max_date * 1000);

    if (min_date < new Date()) {
        min_date = new Date();
    }

    var flot_options = {
        "series": {
            "gantt": {
                "active": true,
                "show": true,
                "barHeight": 5,
            },
        },
        "xaxis": {
            "min": min_date,
            "max": max_date,
            "mode": "time",
        },
        "yaxis": {
            "min": 0.5,
            "max": yaxis_bits.length+0.5,
            "ticks": yaxis_bits,
        },
    }

    $.plot($('#downtimegraph'), flot_data, flot_options);
});<commit_msg>Make the downtime graph work.<commit_after>$(document).ready(function() {
    var downtime = JSON.parse($('#downtimegraph').text());
    $('#downtimegraph').text('');

    var flot_data = []
    var yaxis_bits = [];
    var min_date = downtime[0].start_time;
    var max_date = downtime[0].end_time;

    for (var i=0; i<downtime.length; i++) {
        var dt = downtime[i]
        var y = downtime.length - i;
        flot_data.push({
            'label': dt.expr,
            'data': [[
                new Date(dt.start_time * 1000),
                y,
                new Date(dt.end_time * 1000),
                dt.expr,
            ]],
        });
        yaxis_bits.push([y, dt.expr]);
        if (dt.start_time < min_date) {
            min_date = dt.start_time;
        }
        if (dt.end_time > max_date) {
            max_date = dt.end_time;
        }
    }
    min_date = new Date(min_date * 1000);
    max_date = new Date(max_date * 1000);

    var flot_options = {
        "series": {
            "gantt": {
                "active": true,
                "show": true,
                "barHeight": .5,
            },
        },
        "xaxis": {
            "min": min_date,
            "max": max_date,
            "mode": "time",
        },
        "yaxis": {
            "min": 0.5,
            "max": yaxis_bits.length+0.5,
            "ticks": yaxis_bits,
        },
        "grid": {
            "hoverable": true,
            "clickable": true
        },
        "legend": {
            "show": false,
        }
    }

    var plot = $.plot($('#downtimegraph'), flot_data, flot_options);
});
{'fraction_non_alphanumeric': 0.15558424790187217, 'fraction_numerical': 0.0158166559070368, 'mean_word_length': 1.396751740139211, 'pattern_counts': {'":': 31, '<': 8, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5806916', 'n_tokens_mistral': 1074, 'n_tokens_neox': 999, 'n_words': 189}