<commit_before>var scripts = document.getElementsByTagName('script'),
    script = scripts[scripts.length - 1];

var hours = JSON.parse(script.getAttribute('data-hours')),
    dates = JSON.parse(script.getAttribute('data-dates'));

google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);

var wrapper,
    dataTable;

function drawChart() {
    dataTable = processData();

    if(dataTable.length > 1) {
        wrapper = new google.visualization.ChartWrapper({
            chartType: 'LineChart',
            dataTable: google.visualization.arrayToDataTable(dataTable),
            options: {
                chartArea: {
                    width: '70%',
                    left: '5%'
                },
                pointSize: 6
            },
            containerId: 'chart'
        });

        wrapper.draw();
    }
}

function getIndexOfDate(data, date) {
    for(i = 1; i < data.length; i++) {
        if(data[i][0] === date) {
            return i;
        }
    }
}

function round(x) {
    return Math.round((x * 100)) / 100;
}

function processData() {
    var data = [
        ['Date', 'Billable', 'Non-billable']
    ], i;
   
    for(i = 0; i < dates.length; i++) {
        data.push([dates[i], 0, 0]);
    }
    
    for(var user in hours) {
        var index = 0,
            user_hours = hours[user];

        for(var date in user_hours) {
            index = getIndexOfDate(data, user_hours[date].date);

            data[index][1] += user_hours[date].billable;
            data[index][2] += user_hours[date].nonbillable;
        }
    }

    for(i = 1; i < data.length; i++) {
        data[i][1] = round(data[i][1]);
        data[i][2] = round(data[i][2]);<commit_msg>Changed ordering of data and move to stacked bar chart<commit_after>var scripts = document.getElementsByTagName('script'),
    script = scripts[scripts.length - 1];

var hours = JSON.parse(script.getAttribute('data-hours')),
    dates = JSON.parse(script.getAttribute('data-dates'));

google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);

var wrapper,
    dataTable;

function drawChart() {
    dataTable = processData();

    if(dataTable.length > 1) {
        wrapper = new google.visualization.ChartWrapper({
            chartType: 'ColumnChart',
            dataTable: google.visualization.arrayToDataTable(dataTable),
            options: {
                chartArea: {
                    width: '70%',
                    left: '5%'
                },
                pointSize: 6,
                isStacked: true
            },
            containerId: 'chart'
        });

        wrapper.draw();
    }
}

function getIndexOfDate(data, date) {
    for(i = 1; i < data.length; i++) {
        if(data[i][0] === date) {
            return i;
        }
    }
}

function round(x) {
    return Math.round((x * 100)) / 100;
}

function processData() {
    var data = [
        ['Date', 'Non-billable', 'Billable']
    ], i;
   
    for(i = 0; i < dates.length; i++) {
        data.push([dates[i], 0, 0]);
    }
    
    for(var user in hours) {
        var index = 0,
            user_hours = hours[user];

        for(var date in user_hours) {
            index = getIndexOfDate(data, user_hours[date].date);

            data[index][1] += user_hours[date].nonbillable;
            data[index][2] += user_hours[date].billable;
        }
    }

    for(i = 1; i < data.length; i++) {
        data[i][1] = round(data[i][1]);
        data[i][2] = round(data[i][2]);
{'fraction_non_alphanumeric': 0.15644344400675295, 'fraction_numerical': 0.015194147439504783, 'mean_word_length': 2.028109028960818, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5890921', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1105, 'n_words': 220}