<commit_before>/* VERDADEIRO PARA MOSTRAR SOMENTE NOME DO CURSO, FALSO PARA MOSTRAR VALORES JUNTOS*/
var MOSTRAR_NOME = false;
var regions = {
        "PUB": "Public",
        "PRIV": "Private"
    },
    w = 980,
    h = 600,
    margin = 80,
    startYear = 2009,
    endYear = 2014,
    years = d3.range(startYear, endYear);
var MIN = Number.MAX_VALUE,
    MAX = 0;
var global = {min: 0, max: 0};
var selecionadas = [];
var color = d3.scale.category10();

var startEnd = {};

/*
 * Encontrar os valores minimos e maximos da seleção de cursos para ajustar a escala do grafico
 */
function findMinMax(list) {
    list.forEach(function(l) {
        for (var i = 1; i < 6; i++) {

            if (Number(l[i]) < MIN) {
                MIN = Number(l[i]);
            }
            if (Number(l[i]) > MAX) {
                MAX = Number(l[i]);
            }
        }
    });
}



/*
 * Cria o grafico para mostrar
 */
function Chart() {
    /* Se algum curso foi selecionado via checkbox então carrega o grafico só com ele, senão, carrega o grafico inicial com todos*/
    if (selecionadas.length > 0) {
        document.getElementById("vis").innerHTML = "";
        var vis = d3.select("#vis").append("svg:svg").attr("width", w).attr("height", h).append("svg:g");
        var line = d3.svg.line().x(function(d, i) {
            return x(d.x);
        }).y(function(d) {
            return y(d.y);
        });
        
        for (i = 0; i < selecionadas.length; i++) {
            var values = selecionadas[i].slice(1, selecionadas[i.length - 1]);
            var currData = [];

            var started = false;

            for (j = 0; j < values.length; j++) {
                if (values[j] != '') {
                    currData.push({
                        x: years[j],
                        y: values[j]
                    });
                    if (!started) {
                        startEnd[selecionadas[i][1]] = {
                            'startYear': years[j],
                            'startVal': values[j]
                        };
                        started = true;
                    } else if (j == values.length - 1) {
                        startEnd[selecionadas[i][1]]['endYear'] = years[j];
                        startEnd[selecionadas[i][1]]['endVal'] = values[j];
                    }
                }
            }
            vis.append("svg:path").data([currData]).attr("diciplina", selecionadas[i][0]).attr("class", selecionadas[i][6]).attr("d", line).on("mouseover", onmouseover).on("mouseout", onmouseout);
            if (selecionadas.length < 3) {
                vis.on("click", onclick);
            }
        }

            vis.append("svg:line").attr("x1", x(startYear)).attr("y1", y(MIN)).attr("x2", x(2013.5)).attr("y2", y(MIN)).attr("class", "axis").style("stroke", function(d) { return "#000"; });

        vis.append("svg:line").attr("x1", x(startYear)).attr("y1", y(MIN)).attr("x2", x(startYear)).attr("y2", y(MAX)).attr("class", "axis").style("stroke", function(d) {
            return "#000";
        });

        vis.append("svg:text")
            .attr("text-anchor", "middle") // this makes it easy to centre the text as the transform is applied to the anchor
            .attr("transform", "translate(" + 60 + "," + (h / 2) + ")rotate(-90)") // text is drawn off the screen top left, move down and out and rotate
            .text("Number of Students (square root)");

        vis.append("svg:text")
            .attr("text-anchor", "middle") // this makes it easy to centre the text as the transform is applied to the anchor
            .attr("transform", "translate(" + (w / 2) + "," + (h - 50) + ")") // centre below axis
            .text("Years");

        vis.selectAll(".xLabel").data(x.ticks(4)).enter().append("svg:text").attr("class", "xLabel").text(String).attr("x", function(d) {
            return x(d)
        }).attr("y", h - 10).attr("text-anchor", "middle");
        vis.selectAll(".yLabel").data(y.ticks(4)).enter().append("svg:text").attr("class", "yLabel").text(String).attr("x", 0).attr("y", function(d) {
            return y(d)
        }).attr("text-anchor", "right").attr("dy", 3);

//        vis.selectAll(".xTicks").data(x.ticks(6)).enter().append("svg:line").attr("class", "xTicks").attr("x1", function(d) {
//            return x(d);
//        }).attr("y1", y(MIN)).attr("x2", function(d) {
//            return x(d);
//        }).attr("y2", y(MIN) + 7);<commit_msg>names<commit_after>/* VERDADEIRO PARA MOSTRAR SOMENTE NOME DO CURSO, FALSO PARA MOSTRAR VALORES JUNTOS*/
var MOSTRAR_NOME = false;
var regions = {
        "PUB": "Public",
        "PRIV": "Private"
    },
    w = 980,
    h = 600,
    margin = 80,
    startYear = 2009,
    endYear = 2014,
    years = d3.range(startYear, endYear);
var MIN = Number.MAX_VALUE,
    MAX = 0;
var global = {min: 0, max: 0};
var selecionadas = [];
var color = d3.scale.category10();

var startEnd = {};

/*
 * Encontrar os valores minimos e maximos da seleção de cursos para ajustar a escala do grafico
 */
function findMinMax(list) {
    list.forEach(function(l) {
        for (var i = 1; i < 6; i++) {

            if (Number(l[i]) < MIN) {
                MIN = Number(l[i]);
            }
            if (Number(l[i]) > MAX) {
                MAX = Number(l[i]);
            }
        }
    });
}



/*
 * Cria o grafico para mostrar
 */
function Chart() {
    /* Se algum curso foi selecionado via checkbox então carrega o grafico só com ele, senão, carrega o grafico inicial com todos*/
    if (selecionadas.length > 0) {
        document.getElementById("vis").innerHTML = "";
        var vis = d3.select("#vis").append("svg:svg").attr("width", w).attr("height", h).append("svg:g");
        var line = d3.svg.line().x(function(d, i) {
            return x(d.x);
        }).y(function(d) {
            return y(d.y);
        });
        
        for (i = 0; i < selecionadas.length; i++) {
            var values = selecionadas[i].slice(1, selecionadas[i.length - 1]);
            var currData = [];

            var started = false;

            for (j = 0; j < values.length; j++) {
                if (values[j] != '') {
                    currData.push({
                        x: years[j],
                        y: values[j]
                    });
                    if (!started) {
                        startEnd[selecionadas[i][1]] = {
                            'startYear': years[j],
                            'startVal': values[j]
                        };
                        started = true;
                    } else if (j == values.length - 1) {
                        startEnd[selecionadas[i][1]]['endYear'] = years[j];
                        startEnd[selecionadas[i][1]]['endVal'] = values[j];
                    }
                }
            }
            vis.append("svg:path").data([currData]).attr("diciplina", selecionadas[i][0]).attr("class", selecionadas[i][6]).attr("d", line).on("mouseover", onmouseover).on("mouseout", onmouseout);
            if (selecionadas.length < 3) {
                vis.on("click", onclick);
            }
        }

            vis.append("svg:line").attr("x1", x(startYear)).attr("y1", y(MIN)).attr("x2", x(2013.5)).attr("y2", y(MIN)).attr("class", "axis").style("stroke", function(d) { return "#000"; });

        vis.append("svg:line").attr("x1", x(startYear)).attr("y1", y(MIN)).attr("x2", x(startYear)).attr("y2", y(MAX)).attr("class", "axis").style("stroke", function(d) {
            return "#000";
        });

        vis.append("svg:text")
            .attr("text-anchor", "middle") // this makes it easy to centre the text as the transform is applied to the anchor
            .attr("transform", "translate(" + 60 + "," + (h / 2) + ")rotate(-90)") // text is drawn off the screen top left, move down and out and rotate
            .text("Number of Students (square root)");

        vis.append("svg:text")
            .attr("text-anchor", "start") // this makes it easy to centre the text as the transform is applied to the anchor
            .attr("transform", "translate(" + (20) + "," + (h - 20) + ")") // centre below axis
            .text("Years");

        vis.selectAll(".xLabel").data(x.ticks(4)).enter().append("svg:text").attr("class", "xLabel").text(String).attr("x", function(d) {
            return x(d)
        }).attr("y", h - 10).attr("text-anchor", "middle");
        vis.selectAll(".yLabel").data(y.ticks(4)).enter().append("svg:text").attr("class", "yLabel").text(String).attr("x", 0).attr("y", function(d) {
            return y(d)
        }).attr("text-anchor", "right").attr("dy", 3);

//        vis.selectAll(".xTicks").data(x.ticks(6)).enter().append("svg:line").attr("class", "xTicks").attr("x1", function(d) {
//            return x(d);
//        }).attr("y1", y(MIN)).attr("x2", function(d) {
//            return x(d);
//        }).attr("y2", y(MIN) + 7);
{'fraction_non_alphanumeric': 0.1883131449080305, 'fraction_numerical': 0.017608793180798565, 'mean_word_length': 1.9332236842105264, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 7, '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': '7176321', 'n_tokens_mistral': 2977, 'n_tokens_neox': 2824, 'n_words': 628}