<commit_before>﻿@{
    ViewBag.Title = "Speed Test Results";
}
<br />
<div id="chart_div"></div>
<br />
<h2>Tabulated Data</h2>
<div id="table_div"></div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load('visualization', '1', { packages: ['corechart', 'line'] });
    google.setOnLoadCallback(drawChart);

    function drawChart() {
        
        var jsonData = $.ajax({
            url: "/speedtest-logger/json/days/7",
            dataType: "json",
            async: false
        }).responseText;

        // Create our data table out of JSON data loaded from server.
        var data = new google.visualization.DataTable(jsonData);

        var options = {
            chart: {
                //title: 'Broadband Speed'
            },

            width: 1024,
            height: 600,
            hAxis: { showTextEvery: 5 },
            vAxes: {
                0: {
                    viewWindowMode: 'explicit',
                    viewWindow: {
                        max: 54,
                        min: 0
                    },
                    gridlines: {/*color: 'transparent'*/ },
                    title: 'Speed (MBps)'
                },
                1: {
                    viewWindow: {
                        max: 325,
                        min: 0
                    },
                    gridlines: { color: 'transparent' },
                    title: 'Ping Time (ms)'
                },
            },
            series: {
                // Gives each series an axis name that matches the Y-axis below.

                0: { axis: 'Down', targetAxisIndex: 0 },
                1: { axis: 'Up', targetAxisIndex: 0 },
                2: { axis: 'Ping', targetAxisIndex: 1 }

            },
            axes: {
                // Adds labels to each axis; they don't have to match the axis names.
                y: {

                    Down: {
                        label: 'Down (Mbps)'
                    }
                    ,
                    Up: {
                        label: 'Up (Mbps)',
                        minValue: 0,
                        viewWindow: {
                            min: 0,
                            max: 100
                        },
                        ticks: [0, 25, 50, 75, 100] // display labels every 25


                    },
                    Ping: { label: 'Ping (ms)' }
                },
                x: { 0: { label: 'Time' } }

            }
        };

        var chart = new google.charts.Line(document.getElementById('chart_div'));
        chart.draw(data, google.charts.Line.convertOptions(options));

        //Now load the tabulated data
        loadTableData("/speedtest-logger/table/days/7");
              
        // Handle click of Show Ping Checkbox:
        var showPing = true;
        $("#pingSelect").click(function () {
            view = new google.visualization.DataView(data);
            showPing = !showPing
            if (!showPing) {
                view.hideColumns([3]);
            }
            chart.draw(view, google.charts.Line.convertOptions(options));
            
        });

        //Handle change of dropdown

        $("#duration").change(function () {
            var select = $("#duration option:selected").val();
            var dataURL = "/speedtest-logger/json/days/7";
            switch (select) {
                case "6hours":
                    dataURL = "/speedtest-logger/json/hours/6";
                    break;
                case "12hours":
                    dataURL = "/speedtest-logger/json/hours/12";
                    break;
                case "today":
                    dataURL = "/speedtest-logger/json/days/1";
                    break;
                case "7days":
                    dataURL = "/speedtest-logger/json/days/7";
                    break;
                case "14days":
                    dataURL = "/speedtest-logger/json/days/14";
                    break;
                case "28days":
                    dataURL = "/speedtest-logger/json/days/28";
                    break;
                default:
                    dataURL = "/speedtest-logger/json/days/7";
                    break;
            }
            //end switch
            //grab new data
            var jsonData = $.ajax({
                url: dataURL,
                dataType: "json",
                async: false
            }).responseText;

            // Create our data table out of JSON data loaded from server.
            var data = new google.visualization.DataTable(jsonData);
            view = new google.visualization.DataView(data);
            //Modify the view to hide Ping if required
            if (!showPing) {
                view.hideColumns([3]);
            }
            //Draw
            chart.draw(view, google.charts.Line.convertOptions(options));
            //Load the table
            loadTableData(dataURL.replace("json", "table"));
        });

    }

    function loadTableData(url) {
        $.ajax({
            type: "GET",
            dataType: "html",
            url: url,
            success: function (d) {
                $('#table_div').html(d);
            }
        });
    }
</script><commit_msg>Fixed issue with hiding ping after changing range<commit_after>﻿@{
    ViewBag.Title = "Speed Test Results";
}
<br />
<div id="chart_div"></div>
<br />
<h2>Tabulated Data</h2>
<div id="table_div"></div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load('visualization', '1', { packages: ['corechart', 'line'] });
    google.setOnLoadCallback(drawChart);

    function drawChart() {
        
        var jsonData = $.ajax({
            url: "/speedtest-logger/json/days/7",
            dataType: "json",
            async: false
        }).responseText;

        // Create our data table out of JSON data loaded from server.
        var data = new google.visualization.DataTable(jsonData);

        var options = {
            chart: {
                //title: 'Broadband Speed'
            },

            width: 1024,
            height: 600,
            hAxis: { showTextEvery: 5 },
            vAxes: {
                0: {
                    viewWindowMode: 'explicit',
                    viewWindow: {
                        max: 54,
                        min: 0
                    },
                    gridlines: {/*color: 'transparent'*/ },
                    title: 'Speed (MBps)'
                },
                1: {
                    viewWindow: {
                        max: 325,
                        min: 0
                    },
                    gridlines: { color: 'transparent' },
                    title: 'Ping Time (ms)'
                },
            },
            series: {
                // Gives each series an axis name that matches the Y-axis below.

                0: { axis: 'Down', targetAxisIndex: 0 },
                1: { axis: 'Up', targetAxisIndex: 0 },
                2: { axis: 'Ping', targetAxisIndex: 1 }

            },
            axes: {
                // Adds labels to each axis; they don't have to match the axis names.
                y: {

                    Down: {
                        label: 'Down (Mbps)'
                    }
                    ,
                    Up: {
                        label: 'Up (Mbps)',
                        minValue: 0,
                        viewWindow: {
                            min: 0,
                            max: 100
                        },
                        ticks: [0, 25, 50, 75, 100] // display labels every 25


                    },
                    Ping: { label: 'Ping (ms)' }
                },
                x: { 0: { label: 'Time' } }

            }
        };

        var chart = new google.charts.Line(document.getElementById('chart_div'));
        chart.draw(data, google.charts.Line.convertOptions(options));

        //Now load the tabulated data
        loadTableData("/speedtest-logger/table/days/7");
              
        // Handle click of Show Ping Checkbox:
        var showPing = true;
        $("#pingSelect").click(function () {
            view = new google.visualization.DataView(data);
            showPing = !showPing
            if (!showPing) {
                view.hideColumns([3]);
            }
            chart.draw(view, google.charts.Line.convertOptions(options));
            
        });

        //Handle change of dropdown

        $("#duration").change(function () {
            var select = $("#duration option:selected").val();
            var dataURL = "/speedtest-logger/json/days/7";
            switch (select) {
                case "6hours":
                    dataURL = "/speedtest-logger/json/hours/6";
                    break;
                case "12hours":
                    dataURL = "/speedtest-logger/json/hours/12";
                    break;
                case "today":
                    dataURL = "/speedtest-logger/json/days/1";
                    break;
                case "7days":
                    dataURL = "/speedtest-logger/json/days/7";
                    break;
                case "14days":
                    dataURL = "/speedtest-logger/json/days/14";
                    break;
                case "28days":
                    dataURL = "/speedtest-logger/json/days/28";
                    break;
                default:
                    dataURL = "/speedtest-logger/json/days/7";
                    break;
            }
            //end switch
            //grab new data
            var jsonData = $.ajax({
                url: dataURL,
                dataType: "json",
                async: false
            }).responseText;

            // Create our data table out of JSON data loaded from server.
            data = new google.visualization.DataTable(jsonData);
            view = new google.visualization.DataView(data);
            //Modify the view to hide Ping if required
            if (!showPing) {
                view.hideColumns([3]);
            }
            //Draw
            chart.draw(view, google.charts.Line.convertOptions(options));
            //Load the table
            loadTableData(dataURL.replace("json", "table"));
        });

    }

    function loadTableData(url) {
        $.ajax({
            type: "GET",
            dataType: "html",
            url: url,
            success: function (d) {
                $('#table_div').html(d);
            }
        });
    }
</script>
{'fraction_non_alphanumeric': 0.1176249530251785, 'fraction_numerical': 0.012589252160841788, 'mean_word_length': 1.0657869202406365, 'pattern_counts': {'":': 12, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5619281', 'n_tokens_mistral': 2867, 'n_tokens_neox': 2595, 'n_words': 631}