<commit_before>{% block visoptions %}

<fieldset>

    {% if not vis.options['select-color'] or vis.options['select-color']["default"]  %}
        <div class="control-group select-color">
            <label class="control-label" for="select-color">{% trans "Choose a base color" %}</label>
            <div class="controls">
                <div id="select-color"></div>
            </div>
        </div>
    {% endif %}
    {% if not vis.options['custom-color'] or vis.options['custom-color']["default"]  %}
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <a class="btn btn-small" role="button" href="#customColors">{% trans "or define custom colors" %}</a>
            </div>
        </div>
    {% endif %}
    {% if vis.dimensions == 1 %}
    <div class="control-group select-row">
        <label class="control-label" for="text-title">{% trans "Initial row to display" %}</label>
        <div class="controls">
            <select id="select-row" style="width:100%">
            </select>
        </div>
    </div>
    {% endif %}



    {% for key, option in vis.options %}
        {% if theme['option-filter'][vis.id][key] or (not option.hidden and not option.expert)  %}
    <div class="control-group" style="margin-bottom:0px" id="vis-options-{{ key }}">

        {{ hook('vis_option_controls', option, key) }}

    </div>
    {% endif %}{% endfor %}
</fieldset>

{#
    modal for picking custom colors
#}
<div class="modal hide" id="customColors" style="width:620px;margin-left:-310px" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <p class="lead">{% trans "Customize chart colors" %}</p>
        <p style="border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px">{% trans "Please use custom colors only if it is absolutely necessary, for instance to identify political parties. If possible please use the palette colors." %}</p>

        <div class="row">
            <div class="span2">
                <div>
                    <h4>{% trans "1. Select data series" %}</h4>
                    <ul class="dataseries unstyled">
                    </ul>
                </div>
            </div>
            <div class="span4">
                <div>
                    <h4>{% trans "2. Choose a color for" %} "<span class="selected-series-name"></span>"</h4>
                </div>
                <div class="row">
                    <div class="span2">
                        <label>{% trans "Pick from palette..." %}</label>
                        <div id="palette-colors"></div>
                    </div>
                    <div class="span2">
                        <label>{% trans "...or enter a custom color" %}</label>
                        <div class="control-group">
                            <input id="user-color" type="text" class="text input-small" placeholder="FF0000" />
                        </div>
                    </div>
                </div>
                <div style="margin-top:20px">
                    <button id="reset-color-choice" class="btn">{% trans "Reset color (use default)" %}</button>
                </div>
            </div>
        </div>

    </div>
    <div class="modal-footer">
        <button id="reset-all-colors" class="btn pull-left">{% trans "Reset all colors" %}</button>
        <button class="btn btn-primary" data-dismiss="modal">{% trans "Close" %}</button>
    </div>
</div>
<style type="text/css">

#customColors h4 {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: normal;
}

#customColors .color {
    width: 17px;
    height: 17px;
    float: left;
    background: #ccc;
    text-align: center;
    line-height: 14px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}

#customColors .dataseries li {
    padding-left: 5px;
    padding-bottom: 3px;
    cursor: pointer;
}

#customColors .dataseries label {
    padding-left: 25px;
    line-height: 17px;
    color: #999;
}

#customColors .dataseries .selected label {
    font-weight: bold;
    color: #000;
}


</style>
<script type="text/javascript">

$(function() {
    var chart = DW.currentChart,
        dataset = chart.dataset();

    function syncVisOptions(vis) {
        _.each(vis.options, function(opt, key) {
            if (chart.get('metadata.visualize.'+key) == undefined){
                chart.set('metadata.visualize.'+key, opt.default);
            }
            // fire custom event so hooked vis options can sync
            $('#vis-options').trigger('dw:vis-option:' + $.trim(opt.type), {
                chart: chart,
                key: key,
                option: opt
            });
        });
        // check visibility of each option (evaluate "depends-on" property)
        function checkDepends() {
            var columnsPerAxis = {},
                minColsRegex = /chart\.min_columns\[([^\]]+)\]/,
                maxColsRegex = /chart\.max_columns\[([^\]]+)\]/;

            _.each(DW.currentVis.axes(), function(columns, key) {
                columnsPerAxis[key] = _.isArray(columns) ? columns.length : columns ? 1 : 0;
            });
            _.each(vis.options, function(opt, key) {
                if (opt['depends-on'] !== undefined) {
                    var visible = true;

                    // special conditions:
                    _.each(opt['depends-on'], function(val, key) {
                        if (minColsRegex.test(key)) {
                            key = key.match(minColsRegex)[1];
                            visible = visible && _.isDefined(columnsPerAxis[key]) && columnsPerAxis[key] >= +val;
                        } else if (maxColsRegex.test(key)) {
                            key = key.match(maxColsRegex)[1];
                            visible = visible && _.isDefined(columnsPerAxis[key]) && columnsPerAxis[key] <= +val;
                        } else if (key == 'chart.missing_values') {
                            visible = visible && chart.hasMissingValues() == val;
                        } else if (key == 'chart.min_row_num') {
                            visible = visible && chart.numRows() >= +val;
                        }  else if (key == 'chart.max_row_num') {
                            visible = visible && chart.numRows() <= +val;<commit_msg>using _.isUndefined<commit_after>{% block visoptions %}

<fieldset>

    {% if not vis.options['select-color'] or vis.options['select-color']["default"]  %}
        <div class="control-group select-color">
            <label class="control-label" for="select-color">{% trans "Choose a base color" %}</label>
            <div class="controls">
                <div id="select-color"></div>
            </div>
        </div>
    {% endif %}
    {% if not vis.options['custom-color'] or vis.options['custom-color']["default"]  %}
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <a class="btn btn-small" role="button" href="#customColors">{% trans "or define custom colors" %}</a>
            </div>
        </div>
    {% endif %}
    {% if vis.dimensions == 1 %}
    <div class="control-group select-row">
        <label class="control-label" for="text-title">{% trans "Initial row to display" %}</label>
        <div class="controls">
            <select id="select-row" style="width:100%">
            </select>
        </div>
    </div>
    {% endif %}



    {% for key, option in vis.options %}
        {% if theme['option-filter'][vis.id][key] or (not option.hidden and not option.expert)  %}
    <div class="control-group" style="margin-bottom:0px" id="vis-options-{{ key }}">

        {{ hook('vis_option_controls', option, key) }}

    </div>
    {% endif %}{% endfor %}
</fieldset>

{#
    modal for picking custom colors
#}
<div class="modal hide" id="customColors" style="width:620px;margin-left:-310px" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <p class="lead">{% trans "Customize chart colors" %}</p>
        <p style="border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px">{% trans "Please use custom colors only if it is absolutely necessary, for instance to identify political parties. If possible please use the palette colors." %}</p>

        <div class="row">
            <div class="span2">
                <div>
                    <h4>{% trans "1. Select data series" %}</h4>
                    <ul class="dataseries unstyled">
                    </ul>
                </div>
            </div>
            <div class="span4">
                <div>
                    <h4>{% trans "2. Choose a color for" %} "<span class="selected-series-name"></span>"</h4>
                </div>
                <div class="row">
                    <div class="span2">
                        <label>{% trans "Pick from palette..." %}</label>
                        <div id="palette-colors"></div>
                    </div>
                    <div class="span2">
                        <label>{% trans "...or enter a custom color" %}</label>
                        <div class="control-group">
                            <input id="user-color" type="text" class="text input-small" placeholder="FF0000" />
                        </div>
                    </div>
                </div>
                <div style="margin-top:20px">
                    <button id="reset-color-choice" class="btn">{% trans "Reset color (use default)" %}</button>
                </div>
            </div>
        </div>

    </div>
    <div class="modal-footer">
        <button id="reset-all-colors" class="btn pull-left">{% trans "Reset all colors" %}</button>
        <button class="btn btn-primary" data-dismiss="modal">{% trans "Close" %}</button>
    </div>
</div>
<style type="text/css">

#customColors h4 {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: normal;
}

#customColors .color {
    width: 17px;
    height: 17px;
    float: left;
    background: #ccc;
    text-align: center;
    line-height: 14px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}

#customColors .dataseries li {
    padding-left: 5px;
    padding-bottom: 3px;
    cursor: pointer;
}

#customColors .dataseries label {
    padding-left: 25px;
    line-height: 17px;
    color: #999;
}

#customColors .dataseries .selected label {
    font-weight: bold;
    color: #000;
}


</style>
<script type="text/javascript">

$(function() {
    var chart = DW.currentChart,
        dataset = chart.dataset();

    function syncVisOptions(vis) {
        _.each(vis.options, function(opt, key) {
            if (chart.get('metadata.visualize.'+key) == undefined){
                chart.set('metadata.visualize.'+key, opt.default);
            }
            // fire custom event so hooked vis options can sync
            $('#vis-options').trigger('dw:vis-option:' + $.trim(opt.type), {
                chart: chart,
                key: key,
                option: opt
            });
        });
        // check visibility of each option (evaluate "depends-on" property)
        function checkDepends() {
            var columnsPerAxis = {},
                minColsRegex = /chart\.min_columns\[([^\]]+)\]/,
                maxColsRegex = /chart\.max_columns\[([^\]]+)\]/;

            _.each(DW.currentVis.axes(), function(columns, key) {
                columnsPerAxis[key] = _.isArray(columns) ? columns.length : columns ? 1 : 0;
            });

            _.each(vis.options, function(opt, key) {
                if (opt['depends-on'] !== undefined) {
                    var visible = true;
                    // special conditions:
                    _.each(opt['depends-on'], function(val, key) {
                        if (minColsRegex.test(key)) {
                            key = key.match(minColsRegex)[1];
                            visible = visible && !_.isUndefined(columnsPerAxis[key]) && columnsPerAxis[key] >= +val;
                        } else if (maxColsRegex.test(key)) {
                            key = key.match(maxColsRegex)[1];
                            visible = visible && !_.isUndefined(columnsPerAxis[key]) && columnsPerAxis[key] <= +val;
                        } else if (key == 'chart.missing_values') {
                            visible = visible && chart.hasMissingValues() == val;
                        } else if (key == 'chart.min_row_num') {
                            visible = visible && chart.numRows() >= +val;
                        }  else if (key == 'chart.max_row_num') {
                            visible = visible && chart.numRows() <= +val;
{'fraction_non_alphanumeric': 0.1593696630957926, 'fraction_numerical': 0.009781089892873778, 'mean_word_length': 1.7879246916251894, 'pattern_counts': {'":': 0, '<': 175, '<?xml version=': 0, '>': 175, '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': '6170977', 'n_tokens_mistral': 3881, 'n_tokens_neox': 3621, 'n_words': 866}