Skip to content
Permalink
Browse files

set limit to tooltip content

  • Loading branch information
yuj12001 committed Aug 19, 2015
1 parent c4c7dba commit be8e06e4c5f4bfcaa86e20ae4f043ac049cd91d5
Showing with 44 additions and 7 deletions.
  1. +44 −7 dynamic_loading.php
@@ -527,14 +527,26 @@ function loadCPGTooltip($chrom,$type, $min,$max,$fileHandle){
$res = mysqli_query ($link,$sql);
$returnArray = [];
$compString = "";
$count = 0;
while($row = mysqli_fetch_row($res)){
$start = (string)$row[0];
$end = (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);
return $type.": ".$compString;
}
function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){
@@ -551,19 +563,44 @@ function loadHG19Tooltip($chrom,$type, $min,$max,$fileHandle){
$res = mysqli_query ($link,$sql);
$returnArray = [];
$compString = "";
$count = 0;
while($row = mysqli_fetch_row($res)){
$count++;
if($type == "gene"){
$start = (string)$row[0];
$end = (string)$row[1];
$name = (string)$row[2];
//$compString.(string)$row[0]."-".(string)$row[1].", ";
$compString .= $name." (".$start."-".$end."), ";
if($count > 5){
$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{
$name = (string)$row[2];
$start = substr((string)$row[3],0,-1);
$end = substr((string)$row[4],0,-1);
$compString .= $name."(".$start."-".$end."), ";
if($count > 1){
$compString = substr($compString,0,-2);
$compString .= " ... zoom in to see more ";
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;
}
}
}

0 comments on commit be8e06e

Please sign in to comment.
You can’t perform that action at this time.