<commit_before>function redrawChart() {
    var stCode = currServiceType;
    var numOfDays = 7;
    var url = window.apiDomain + 'requests/' + stCode + '/counts.json?end_date=' + currWeekEnd.format(dateFormat) + '&count=' + numOfDays + '&callback=?';
    var chart = $('#chart').highcharts();

    $.getJSON(
        url,
        function(response) {
            var cityAverage = response['0'] / 50;
            var counts = _.pairs(response).slice(1,51);

            // var sorted = _.sortBy(counts,function(pair) { return pair[1]; }).reverse();
            // var sortedCategories = _.map(sorted, function(pair) { return "Ward " + pair[0]; });
            // var sortedFakeWardAverages = _.map(sorted, function(pair) { return Math.max(pair[1] - Math.ceil((Math.random() - 0.5) * 20),0); });

            if (chart) {
                chart.get('counts').setData(counts);
                chart.yAxis[0].removePlotLine('avg');
                chart.yAxis[0].addPlotLine({
                    id: 'avg',
                    value: cityAverage,
                    color: 'brown',
                    width: 3,
                    zIndex:5
                });
            } else {
                var categories = _.map(counts, function(pair) { return "Ward " + pair[0]; });
                var fakeWardAverages = _.map(counts, function(pair) { return Math.max(pair[1] - Math.ceil((Math.random() - 0.5) * 20),0); });

                new Highcharts.Chart({
                    chart: {
                        renderTo: 'chart'
                    },
                    series: [{
                        data: counts,
                        id: 'counts',
                        index: 2,
                        dataLabels: {
                            style: {
                                fontWeight: 'bold'
                            }
                        }
                    },{
                        data: fakeWardAverages,
                        index: 1
                    }],
                    xAxis: {
                        categories: categories
                    },
                    yAxis: {
                        plotLines: [{
                            id: 'avg',
                            value: cityAverage,<commit_msg>Updated the JS on Service detail page to match new JSON format.<commit_after>function redrawChart() {
    var stCode = currServiceType;
    var numOfDays = 7;
    var url = window.apiDomain + 'requests/' + stCode + '/counts.json?end_date=' + currWeekEnd.format(dateFormat) + '&count=' + numOfDays + '&callback=?';
    var chart = $('#chart').highcharts();

    $.getJSON(
        url,
        function(response) {
            var cityAverage = response['0'].Count / 50;
            var counts = _.rest(_.pluck(response, 'Count'));

            // var sorted = _.sortBy(counts,function(pair) { return pair[1]; }).reverse();
            // var sortedCategories = _.map(sorted, function(pair) { return "Ward " + pair[0]; });
            // var sortedFakeWardAverages = _.map(sorted, function(pair) { return Math.max(pair[1] - Math.ceil((Math.random() - 0.5) * 20),0); });

            if (chart) {
                chart.get('counts').setData(counts);
                chart.yAxis[0].removePlotLine('avg');
                chart.yAxis[0].addPlotLine({
                    id: 'avg',
                    value: cityAverage,
                    color: 'brown',
                    width: 3,
                    zIndex:5
                });
            } else {
                var categories = _.map(counts, function(ward) { return "Ward " + ward[0]; });
                var averages = _.map(_.rest(_.pluck(response, 'Average')), Math.round);

                new Highcharts.Chart({
                    chart: {
                        renderTo: 'chart'
                    },
                    series: [{
                        data: counts,
                        id: 'counts',
                        index: 2,
                        dataLabels: {
                            style: {
                                fontWeight: 'bold'
                            }
                        }
                    },{
                        data: averages,
                        index: 1
                    }],
                    xAxis: {
                        categories: categories
                    },
                    yAxis: {
                        plotLines: [{
                            id: 'avg',
                            value: cityAverage,
{'fraction_non_alphanumeric': 0.12464151775865873, 'fraction_numerical': 0.010368409441870726, 'mean_word_length': 1.0712654179990864, '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': '783945', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1104, 'n_words': 233}