<commit_before><!--
     All Emoncms code is released under the GNU Affero General Public License.
     See COPYRIGHT.txt and LICENSE.txt.

        ---------------------------------------------------------------------
        Emoncms - open source energy visualisation
        Part of the OpenEnergyMonitor project:
        http://openenergymonitor.org
-->

<?php
    global $path;
    $embed = intval(get("embed"));
    $mid = intval(get("mid"));
?>

<!--[if IE]><script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.selection.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.time.min.js"></script>

<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/common/api.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/common/inst.js"></script>

<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/multigraph.js"></script>

<?php if (!$embed) { ?>
<h2>Multigraph</h2>
<?php } ?>


<div id="multigraph"></div>

<script id="source" language="javascript" type="text/javascript">

    var mid = <?php echo $mid; ?>;
    var path = "<?php echo $path; ?>";
    var embed = <?php echo $embed; ?>;
    var apikey = "<?php echo $apikey; ?>";
    var multigraph_feedlist = {};

    $.ajax({ url: path+"vis/multigraph/get.json", data: "&id="+mid, dataType: 'json', async: true,
        success: function(data)
        {
                multigraph_feedlist = data;

                var timeWindow = (3600000*24.0*7);              //Initial time window
                var start = ((new Date()).getTime())-timeWindow;        //Get start time
                var end = (new Date()).getTime();               //Get end time

                multigraph_init("#multigraph");
                vis_feed_data();
        }
    });

    function showTooltip(x, y, contents, bgColour) {
        var offset = 15; // use higher values for a little spacing between `x,y` and tooltip
        var elem = $('<div id="tooltip">' + contents + '</div>').css({
            position: 'absolute',
            display: 'none',
            'font-weight':'bold',
            border: '1px solid rgb(255, 221, 221)',
            padding: '2px',
            'background-color': bgColour,
            opacity: '0.8'
        }).appendTo("body").fadeIn(200);
            //x = x - elem.width();
        elem.css({
            top: y - elem.height() - offset,
            left: x - elem.width() - offset,
        });
    }

    var previousPoint = null;
    $("#multigraph").bind("plothover", function (event, pos, item)
    {
        $("#x").text(pos.x.toFixed(2));
            $("#y").text(pos.y2.toFixed(2));

        if ($("#enableTooltip:checked").length > 0) {
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;

                    $("#tooltip").remove();
                    var x = item.datapoint[0].toFixed(2),
                    y = item.datapoint[1].toFixed(2);

                    // create a new javascript Date object based on the timestamp
                    // This implementation is clumsy, but the js native date.toTimeString() returns
                    // strings like "08:53:35 GMT-0800", and there is no easy way to turn off the "GMT-xxxx" segment
                    // blargh<commit_msg>Update multigraph.php<commit_after><!--
     All Emoncms code is released under the GNU Affero General Public License.
     See COPYRIGHT.txt and LICENSE.txt.

        ---------------------------------------------------------------------
        Emoncms - open source energy visualisation
        Part of the OpenEnergyMonitor project:
        http://openenergymonitor.org
-->

<?php
    global $path;
    $embed = intval(get("embed"));
    $mid = intval(get("mid"));
?>

<!--[if IE]><script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.selection.min.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path;?>Lib/flot/jquery.flot.time.min.js"></script>

<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/common/api.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/common/inst.js"></script>

<script language="javascript" type="text/javascript" src="<?php echo $path; ?>Modules/vis/visualisations/multigraph.js"></script>

<?php if (!$embed) { ?>
<h2>Multigraph</h2>
<?php } ?>


<div id="multigraph"></div>

<script id="source" language="javascript" type="text/javascript">

    var mid = <?php echo $mid; ?>;
    var path = "<?php echo $path; ?>";
    var embed = <?php echo $embed; ?>;
    var apikey = "<?php echo $apikey; ?>";
    var multigraph_feedlist = {};

    $.ajax({ url: path+"vis/multigraph/get.json", data: "&id="+mid, dataType: 'json', async: true,
        success: function(data)
        {
                multigraph_feedlist = data;

                var timeWindow = (3600000*24.0*7);              //Initial time window
                var start = ((new Date()).getTime())-timeWindow;        //Get start time
                var end = (new Date()).getTime();               //Get end time

                multigraph_init("#multigraph");
                vis_feed_data();
        }
    });

    function showTooltip(x, y, contents, bgColour) {
        var offset = 15; // use higher values for a little spacing between `x,y` and tooltip
        var elem = $('<div id="tooltip">' + contents + '</div>').css({
            position: 'absolute',
            display: 'none',
            'font-weight':'bold',
            border: '1px solid rgb(255, 221, 221)',
            padding: '2px',
            'background-color': bgColour,
            opacity: '0.8'
        }).appendTo("body").fadeIn(200);
            //x = x - elem.width();
        elem.css({
            top: y - elem.height() - offset,
            left: x - elem.width() - offset,
        });
    }

    var previousPoint = null;
    $("#multigraph").bind("plothover", function (event, pos, item)
    {
        $("#x").text(pos.x.toFixed(2));
            $("#y").text(pos.y.toFixed(2));

        if ($("#enableTooltip:checked").length > 0) {
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;

                    $("#tooltip").remove();
                    var x = item.datapoint[0].toFixed(2),
                    y = item.datapoint[1].toFixed(2);

                    // create a new javascript Date object based on the timestamp
                    // This implementation is clumsy, but the js native date.toTimeString() returns
                    // strings like "08:53:35 GMT-0800", and there is no easy way to turn off the "GMT-xxxx" segment
                    // blargh
{'fraction_non_alphanumeric': 0.1837329447608955, 'fraction_numerical': 0.01284938402437409, 'mean_word_length': 2.2278751603249254, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 81, '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': '6332478', 'n_tokens_mistral': 2273, 'n_tokens_neox': 2153, 'n_words': 534}