<commit_before>{% extends "orgs/report_base.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load i18n %}

{% block js %}{{ block.super }}
    <link href="{% static 'hqwebapp/js/lib/nvd3/nv.d3.css' %}" rel="stylesheet">
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/d3.v2.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/fisheye.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/nv.d3.min.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/history-1.7.1.js' %}"></script>
{% endblock %}

{% block js-inline %} {{ block.super }}
    <script src="{% static 'hqwebapp/js/hash-tab.js' %}"></script>
    <script src='{% static 'hqadmin/js/nvd3_charts_helper.js' %}' type='text/javascript'></script>
    <script type="text/javascript">
        var charts = { "bar-chart": null, "cumulative-chart": null, "stacked-cumulative-chart": null };

        // given the chart_id of a chart element in the dom, the function fetches the data associated with that chart
        // and renders the chart in the specified element
        function loadChartData(callback_fn, startdate, enddate) {
            var $loading = $('.loading');
            var $charts = $('.nvd3-chart');

            $loading.show();
            $charts.each(function(){
                var $this = $(this);
                $(this).hide().html('').append("<svg style='height:320px'> </svg>"); // create a new svg element to stop update issues
            });

            var data = {histogram_type: "{{ stat_slug }}"};
            if (enddate) {
                data["enddate"] = enddate;
            }
            if (startdate) {
                data["startdate"] = startdate;
            }

            $.getJSON('{% url orgs_stats_data org.name %}', data,
                function(d) {
                    var startdate = new Date(Date.UTC(d.startdate[0], d.startdate[1]-1, d.startdate[2]));
                    var enddate = new Date(Date.UTC(d.enddate[0], d.enddate[1]-1, d.enddate[2]));
                    charts = loadCharts("{{ xaxis_label }}", d.histo_data, d.initial_values,
                            startdate.getTime(), enddate.getTime());
                    $loading.hide();
                    $charts.show();
<commit_msg>set width to pixel value to get around nvd3 bug<commit_after>{% extends "orgs/report_base.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load i18n %}

{% block js %}{{ block.super }}
    <link href="{% static 'hqwebapp/js/lib/nvd3/nv.d3.css' %}" rel="stylesheet">
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/d3.v2.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/lib/fisheye.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/nvd3/nv.d3.min.js' %}"></script>
    <script src="{% static 'hqwebapp/js/lib/history-1.7.1.js' %}"></script>
{% endblock %}

{% block js-inline %} {{ block.super }}
    <script src="{% static 'hqwebapp/js/hash-tab.js' %}"></script>
    <script src='{% static 'hqadmin/js/nvd3_charts_helper.js' %}' type='text/javascript'></script>
    <script type="text/javascript">
        var charts = { "bar-chart": null, "cumulative-chart": null, "stacked-cumulative-chart": null };

        // given the chart_id of a chart element in the dom, the function fetches the data associated with that chart
        // and renders the chart in the specified element
        function loadChartData(callback_fn, startdate, enddate) {
            var $loading = $('.loading');
            var $charts = $('.nvd3-chart');

            $loading.show();
            var svg_width = $(".tab-pane").first().width();
            $charts.each(function(){
                // hack: need to explicitly set the width to a pixel value because nvd3 has issues when it's set to 100%
                var $svg_ele = $("<svg style='height:320px;'> </svg>").width(svg_width);
                $(this).hide().html('').append($svg_ele); // create a new svg element to stop update issues
            });

            var data = {histogram_type: "{{ stat_slug }}"};
            if (enddate) {
                data["enddate"] = enddate;
            }
            if (startdate) {
                data["startdate"] = startdate;
            }

            $.getJSON('{% url orgs_stats_data org.name %}', data,
                function(d) {
                    var startdate = new Date(Date.UTC(d.startdate[0], d.startdate[1]-1, d.startdate[2]));
                    var enddate = new Date(Date.UTC(d.enddate[0], d.enddate[1]-1, d.enddate[2]));
                    charts = loadCharts("{{ xaxis_label }}", d.histo_data, d.initial_values,
                            startdate.getTime(), enddate.getTime());
                    $loading.hide();
                    $charts.show();

{'fraction_non_alphanumeric': 0.17503136762860727, 'fraction_numerical': 0.01191969887076537, 'mean_word_length': 2.262619372442019, 'pattern_counts': {'":': 6, '<': 35, '<?xml version=': 0, '>': 35, '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': '6602063', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1500, 'n_words': 340}