<commit_before>{% extends "layout.html.twig" %}

{% block stylesheet %}
    {{ parent() }}
{% endblock %}

{% block javascript %}
    {{ parent() }}
    {{ highcharts_js|raw }}

    <script>
        $(document).ready(function() {

            // Form with all the chart options
            var form = $('form#options');

            // Call updateChart for form events
            form.change(updateChart);
            form.find('button').click(updateChart)
            form.submit(updateChart);

            // Different zoom actions
            $('#zoom_reset').click(function () {
                // Sets the default zoom
                chart.xAxis[0].setExtremes(null, null, false);
                chart.yAxis[0].setExtremes(null, null, false);
                chart.redraw()
            });
            $('#zoom_ratio_11').click(zoomRatio11);
            function zoomRatio11() {
                // Sets a zoom where both axis have the same aspect ratio (1:1)

                // Iterate all series to obtain the absolute min&max
                // (the min&max values for every serie are already calculated)
                var absolute_min = null;
                var absolute_max = null;
                for (i = 0; i < chart.series.length; i++) {
                    if (absolute_min == null) absolute_min = chart.series[i].options.x_min;
                    if (absolute_max == null) absolute_max = chart.series[i].options.x_max;
                    if (absolute_min > chart.series[i].options.x_min) absolute_min = chart.series[i].options.x_min;
                    if (absolute_max < chart.series[i].options.x_max) absolute_max = chart.series[i].options.x_max;
                    if (absolute_min > chart.series[i].options.y_min) absolute_min = chart.series[i].options.y_min;
                    if (absolute_max < chart.series[i].options.y_max) absolute_max = chart.series[i].options.y_max;
                }

                // Calculate the current aspect ratio of the graph
                var x_extremes = chart.xAxis[0].getExtremes();
                var y_extremes = chart.yAxis[0].getExtremes();
                var chart_width = chart.xAxis[0].toPixels(x_extremes.max) - chart.xAxis[0].toPixels(x_extremes.min);
                var chart_height = chart.yAxis[0].toPixels(y_extremes.min) - chart.yAxis[0].toPixels(y_extremes.max);
                var aspect_ratio = chart_width / chart_height;

                // Change zoom
                chart.xAxis[0].setExtremes(absolute_min, absolute_max * aspect_ratio, false);
                chart.yAxis[0].setExtremes(absolute_min, absolute_max , false);
                chart.redraw()
            }

            function updateChart(event) {
                // Start loading<commit_msg>DBSCAN zoom 1:1 now tries to show the maximum area with points<commit_after>{% extends "layout.html.twig" %}

{% block stylesheet %}
    {{ parent() }}
{% endblock %}

{% block javascript %}
    {{ parent() }}
    {{ highcharts_js|raw }}

    <script>
        $(document).ready(function() {

            // Form with all the chart options
            var form = $('form#options');

            // Call updateChart for form events
            form.change(updateChart);
            form.find('button').click(updateChart)
            form.submit(updateChart);

            // Different zoom actions
            $('#zoom_reset').click(function () {
                // Sets the default zoom
                chart.xAxis[0].setExtremes(null, null, false);
                chart.yAxis[0].setExtremes(null, null, false);
                chart.redraw()
            });
            $('#zoom_ratio_11').click(zoomRatio11);
            function zoomRatio11() {
                // Sets a zoom where both axis have the same aspect ratio (1:1)

                // Iterate all series to obtain the absolute min&max
                // (the min&max values for every serie are already calculated)
                var absolute_x_min = null;
                var absolute_x_max = null;
                var absolute_y_min = null;
                var absolute_y_max = null;
                for (i = 0; i < chart.series.length; i++) {
                    if (absolute_x_min == null) absolute_x_min = chart.series[i].options.x_min;
                    if (absolute_x_max == null) absolute_x_max = chart.series[i].options.x_max;
                    if (absolute_y_min == null) absolute_y_min = chart.series[i].options.y_min;
                    if (absolute_y_max == null) absolute_y_max = chart.series[i].options.y_max;
                    if (absolute_x_min > chart.series[i].options.x_min) absolute_x_min = chart.series[i].options.x_min;
                    if (absolute_x_max < chart.series[i].options.x_max) absolute_x_max = chart.series[i].options.x_max;
                    if (absolute_y_min > chart.series[i].options.y_min) absolute_y_min = chart.series[i].options.y_min;
                    if (absolute_y_max < chart.series[i].options.y_max) absolute_y_max = chart.series[i].options.y_max;
                }

                // Calculate the current aspect ratio of the graph
                var x_extremes = chart.xAxis[0].getExtremes();
                var y_extremes = chart.yAxis[0].getExtremes();
                var chart_width = chart.xAxis[0].toPixels(x_extremes.max) - chart.xAxis[0].toPixels(x_extremes.min);
                var chart_height = chart.yAxis[0].toPixels(y_extremes.min) - chart.yAxis[0].toPixels(y_extremes.max);
                var aspect_ratio = chart_width / chart_height;

                // Change zoom
                var absolute_min = Math.min(absolute_x_min, absolute_y_min);
                var absolute_max = Math.max(absolute_x_max, absolute_y_max);
                if ((absolute_x_max - absolute_x_min) > (absolute_y_max - absolute_y_min)) {
                    // Points form a horizontal rectangle
                    chart.xAxis[0].setExtremes(absolute_min, absolute_max, false);
                    chart.yAxis[0].setExtremes(absolute_min, absolute_max / aspect_ratio, false);
                } else if ((absolute_x_max - absolute_x_min) < (absolute_y_max - absolute_y_min)) {
                    // Points form a vertical rectangle
                    chart.xAxis[0].setExtremes(absolute_min, absolute_max * aspect_ratio, false);
                    chart.yAxis[0].setExtremes(absolute_min, absolute_max, false);
                } else {
                    // Points form a square
                    if (aspect_ratio > 1) {
                        // Viewport is a horizontal rectangle
                        // Expand the X axis
                        chart.xAxis[0].setExtremes(absolute_min, absolute_max * aspect_ratio, false);
                        chart.yAxis[0].setExtremes(absolute_min, absolute_max, false);
                    } else {
                        // Viewport is a vertical rectangle
                        // Expand the Y axis
                        chart.xAxis[0].setExtremes(absolute_min, absolute_max, false);
                        chart.yAxis[0].setExtremes(absolute_min, absolute_max / aspect_ratio, false);
                    }
                }
                chart.redraw()
            }

            function updateChart(event) {
                // Start loading
{'fraction_non_alphanumeric': 0.10886875343218012, 'fraction_numerical': 0.006452498627127952, 'mean_word_length': 1.7542533081285445, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, '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': '7044509', 'n_tokens_mistral': 2122, 'n_tokens_neox': 1996, 'n_words': 421}