<commit_before><?php
/*=========================================================================

  Program:   CDash - Cross-Platform Dashboard System
  Module:    $RCSfile: common.php,v $
  Language:  PHP
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Kitware, Inc.  All rights reserved.
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
include("../config.php");
include("../common.php");

$buildid = $_GET["buildid"];

$db = mysql_connect("$CDASH_DB_HOST", "$CDASH_DB_LOGIN","$CDASH_DB_PASS");
mysql_select_db("$CDASH_DB_NAME",$db);

// Find the project variables
$build = mysql_query("SELECT name,type,siteid,projectid,starttime FROM build WHERE id='$buildid'");
$build_array = mysql_fetch_array($build);

$buildtype = $build_array["type"];
$buildname = $build_array["name"];
$siteid = $build_array["siteid"];
$starttime = $build_array["starttime"];
$projectid = $build_array["projectid"];

$project = mysql_query("SELECT name FROM project WHERE id='$projectid'");
$project_array = mysql_fetch_array($project);

// Find the other builds
$previousbuilds = mysql_query("SELECT id,starttime,endtime FROM build WHERE siteid='$siteid' AND type='$buildtype' AND name='$buildname'
                               AND projectid='$projectid' AND starttime<='$starttime' ORDER BY starttime ASC");
?>

				
<br>
<script id="source" language="javascript" type="text/javascript">
$(function () {
    var d1 = [];
				var tx = [];
				var ty = [];
				<?php
				$i=0;
				while($build_array = mysql_fetch_array($previousbuilds))
						{
				?>
						d1.push([<?php echo $build_array["id"]; ?>,<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>]);
				  tx.push([<?php echo $build_array["id"]; ?>,"<?php echo $build_array["starttime"]; ?>"]);
						ty.push([<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>,"<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>"]);
				<?php
				$i++;
					 }
				?>
		$.plot($("#grapholder"), [{label: "Build Time (seconds)",  data: d1}],
		      {
        lines: { show: true },
        points: { show: true },
        xaxis: {
         ticks: tx
        },
        yaxis: {
         ticks: ty
								},
        grid: {
            backgroundColor: "#fffaff"
        },
								colors: ["#0000FF", "#dba255", "#919733"]					
								}
		);
});
</script><commit_msg>ENH: Added zoom support<commit_after><?php
/*=========================================================================

  Program:   CDash - Cross-Platform Dashboard System
  Module:    $RCSfile: common.php,v $
  Language:  PHP
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Kitware, Inc.  All rights reserved.
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
include("../config.php");
include("../common.php");

$buildid = $_GET["buildid"];

$db = mysql_connect("$CDASH_DB_HOST", "$CDASH_DB_LOGIN","$CDASH_DB_PASS");
mysql_select_db("$CDASH_DB_NAME",$db);

// Find the project variables
$build = mysql_query("SELECT name,type,siteid,projectid,starttime FROM build WHERE id='$buildid'");
$build_array = mysql_fetch_array($build);

$buildtype = $build_array["type"];
$buildname = $build_array["name"];
$siteid = $build_array["siteid"];
$starttime = $build_array["starttime"];
$projectid = $build_array["projectid"];

$project = mysql_query("SELECT name FROM project WHERE id='$projectid'");
$project_array = mysql_fetch_array($project);

// Find the other builds
$previousbuilds = mysql_query("SELECT id,starttime,endtime FROM build WHERE siteid='$siteid' AND type='$buildtype' AND name='$buildname'
                               AND projectid='$projectid' AND starttime<='$starttime' ORDER BY starttime ASC");
?>

				
<br>
<script id="source" language="javascript" type="text/javascript">
$(function () {
    var d1 = [];
				var tx = [];
				var ty = [];
				<?php
				$i=0;
				while($build_array = mysql_fetch_array($previousbuilds))
						{
				?>
						d1.push([<?php echo $build_array["id"]; ?>,<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>]);
				  tx.push([<?php echo $build_array["id"]; ?>,"<?php echo $build_array["starttime"]; ?>"]);
						ty.push([<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>,"<?php echo strtotime($build_array["endtime"])-strtotime($build_array["starttime"]); ?>"]);
				<?php
				$i++;
					 }
				?>
				
				$("#grapholder").bind("selected", function (event, area) {
        $("#selection").text(area.x1.toFixed(1) + " to " + area.x2.toFixed(1));

        var zoom = $("#zoom").attr("checked");
        if (zoom)
            plot = $.plot($("#grapholder"), data,
                          $.extend(true, {}, options, {
                              xaxis: { min: area.x1, max: area.x2 }
                          }));
    });
				
		$.plot($("#grapholder"), [{label: "Build Time (seconds)",  data: d1}],
		      {
        lines: { show: true },
        points: { show: true },
        xaxis: {
         ticks: tx
        },
        yaxis: {
         ticks: ty
								},
        grid: {
            backgroundColor: "#fffaff"
        },
								colors: ["#0000FF", "#dba255", "#919733"],
								selection: { mode: "x" }					
					   
								}
		);
});
</script>
{'fraction_non_alphanumeric': 0.21669746346379976, 'fraction_numerical': 0.008063161431211155, 'mean_word_length': 3.473328324567994, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1523802', 'n_tokens_mistral': 2035, 'n_tokens_neox': 1792, 'n_words': 393}