Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
set limit to tooltip content
  • Loading branch information
yuj12001 committed Aug 19, 2015
1 parent c4c7dba commit be8e06e
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions dynamic_loading.php
Expand Up @@ -527,14 +527,26 @@
$res = mysqli_query ($link,$sql); $res = mysqli_query ($link,$sql);
$returnArray = []; $returnArray = [];
$compString = ""; $compString = "";
$count = 0;

while($row = mysqli_fetch_row($res)){ while($row = mysqli_fetch_row($res)){
$start = (string)$row[0]; $start = (string)$row[0];
$end = (string)$row[1]; $end = (string)$row[1];
//$compString.(string)$row[0]."-".(string)$row[1].", "; //$compString.(string)$row[0]."-".(string)$row[1].", ";
$compString .= $start."-".$end.", "; $count++;
if($count > 5){
$compString = substr($compString,0,-2);
$compString .= " ... zoom in to see more ";
break;
}
else{
$compString .= $start." - ".$end.", ";
}
} }
$compString = substr($compString,0,-2); $compString = substr($compString,0,-2);
return $type.": ".$compString; return $type.": ".$compString;


} }


function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){ function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){
Expand All @@ -551,19 +563,44 @@
$res = mysqli_query ($link,$sql); $res = mysqli_query ($link,$sql);
$returnArray = []; $returnArray = [];
$compString = ""; $compString = "";
$count = 0;
while($row = mysqli_fetch_row($res)){ while($row = mysqli_fetch_row($res)){
$count++;
if($type == "gene"){ if($type == "gene"){
$start = (string)$row[0]; $start = (string)$row[0];
$end = (string)$row[1]; $end = (string)$row[1];
$name = (string)$row[2]; $name = (string)$row[2];
//$compString.(string)$row[0]."-".(string)$row[1].", "; if($count > 5){
$compString .= $name." (".$start."-".$end."), "; $compString = substr($compString,0,-2);
$compString .= " ... zoom in to see more ";
break;
}
else{
//$compString.(string)$row[0]."-".(string)$row[1].", ";
$compString .= $name." (".$start." - ".$end."), ";
}
} }
else{ else{
$name = (string)$row[2]; if($count > 1){
$start = substr((string)$row[3],0,-1); $compString = substr($compString,0,-2);
$end = substr((string)$row[4],0,-1); $compString .= " ... zoom in to see more ";
$compString .= $name."(".$start."-".$end."), "; break;
}
else{
$name = (string)$row[2];
$start = substr((string)$row[3],0,-1);
$end = substr((string)$row[4],0,-1);
$start_array = explode(",",$start);
$end_array = explode(",",$end);
$exons = "";
foreach ($start_array as $key => $value) {

$exons .= "(".$value." - ".$end_array[$key]."), ";
}

$compString .= $name." ".$exons;
}

} }


} }
Expand Down

0 comments on commit be8e06e

Please sign in to comment.