<commit_before>(function(global) {
    'use strict';

    $(document).ready(function() {
        setupSurveyScheduleWindows();
        setupSurveyResultCharts();
        setupSubmissionButtons();
    });

    function setupSurveyResultCharts() {
        $('#survey-results .survey-pie-chart').each(function(idx, elem) {
            var chart = new Chartist.Pie(elem, {
                labels: $(elem).data('labels'),
                series: $(elem).data('series-relative')
            }, {
                donut: true,
                donutWidth: 20,
                startAngle: 270,
                total: 1,
                chartPadding: 20,
                labelOffset: 20,
                labelDirection: 'explode'
            }).on('draw', function removeEmptyLabels(data) {
                if (data.value === 0) {
                    chart.data.labels[data.index] = '';
                }
            });
        });

        $('#survey-results .survey-bar-chart').each(function(idx, elem) {
            new Chartist.Bar(elem, {
                labels: $(elem).data('labels'),
                series: [$(elem).data('series-absolute')]
            }, {
                horizontalBars: true,
                height: $(elem).parents('.i-box-content').outerHeight(),
                reverseData: true,
                axisX: {
                    onlyInteger: true,
                },
                axisY: {
                    offset: 50
                }
            });
        });
    }

    function setupSurveyScheduleWindows() {
        $('a.js-survey-schedule-dialog').on('click', function(evt) {
            evt.preventDefault();
            ajaxDialog({
                url: build_url($(this).data('href')),
                title: $(this).data('title'),
                onClose: function(data) {
                    if (data) {
                        location.reload();
                    }
                }
            });
        });<commit_msg>Prevent survey charts from overlapping bars<commit_after>(function(global) {
    'use strict';

    $(document).ready(function() {
        setupSurveyScheduleWindows();
        setupSurveyResultCharts();
        setupSubmissionButtons();
    });

    function setupSurveyResultCharts() {
        $('#survey-results .survey-pie-chart').each(function(idx, elem) {
            var chart = new Chartist.Pie(elem, {
                labels: $(elem).data('labels'),
                series: $(elem).data('series-relative')
            }, {
                donut: true,
                donutWidth: 20,
                startAngle: 270,
                total: 1,
                chartPadding: 20,
                labelOffset: 20,
                labelDirection: 'explode'
            }).on('draw', function removeEmptyLabels(data) {
                if (data.value === 0) {
                    chart.data.labels[data.index] = '';
                }
            });
        });

        $('#survey-results .survey-bar-chart').each(function(idx, elem) {
            var labels = $(elem).data('labels');
            var labelsHeight = labels.length * 20;
            var containerHeight = $(elem).parents('.i-box-content').outerHeight();
            new Chartist.Bar(elem, {
                labels: labels,
                series: [$(elem).data('series-absolute')]
            }, {
                horizontalBars: true,
                height: Math.max(labelsHeight, containerHeight) + 'px',
                reverseData: true,
                axisX: {
                    onlyInteger: true,
                },
                axisY: {
                    offset: 50
                }
            });
        });
    }

    function setupSurveyScheduleWindows() {
        $('a.js-survey-schedule-dialog').on('click', function(evt) {
            evt.preventDefault();
            ajaxDialog({
                url: build_url($(this).data('href')),
                title: $(this).data('title'),
                onClose: function(data) {
                    if (data) {
                        location.reload();
                    }
                }
            });
        });
{'fraction_non_alphanumeric': 0.13658418243571083, 'fraction_numerical': 0.006792819019893256, 'mean_word_length': 1.2691249312052835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '812662', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1013, 'n_words': 171}