Commit acd30c13 authored by Romain Loth's avatar Romain Loth

inst pie more agregated => more often informative + some tweaks for better...

inst pie more agregated => more often informative + some tweaks for better display of piechart labels (but can do better)
parent c152b2c1
......@@ -87,12 +87,16 @@ function split_join_keywords_for_html($str_value) {
}
function shorter_html_label($label) {
$calibre = 17;
$calibre = 20;
// shorter label via acro extraction
// if POSSible: use orgs.toarray to avoid matching
$matches = array();
preg_match_all('/^([^(]+\()([^)]+)(\).*)$/U', $label, $matches);
if (count($matches)) {
if (count($matches)
&& isset($matches[1]) && isset($matches[1][0])
&& isset($matches[2]) && isset($matches[2][0])
&& isset($matches[3]) && isset($matches[3][0])
) {
$label = $matches[2][0];
$lhs = substr($matches[1][0], 0, -1) ; // rm opening paren
$rhs = substr($matches[3][0], 1); // rm closing paren
......@@ -103,7 +107,7 @@ function shorter_html_label($label) {
$label .= ' <span style="font-size:8px">'.$remainder.'</span>';
}
else {
$label = '<span style="font-size:8px">'.substr($label, 0, $calibre.'...').'</span>';
$label = '<span style="font-size:8px">'.substr($label, 0, $calibre).'...'.'</span>';
}
return $label;
}
......
......@@ -8,7 +8,7 @@
// parameters : threshold to display orgs (labs / institutions) diagrams
$MIN_DISTINCT_LABS = 1 ;
$MIN_DISTINCT_LABS_SCHOLARS_SHARE = .15;
$MIN_DISTINCT_LABS_SCHOLARS_SHARE = .10;
$MIN_DISTINCT_INSTS = 1 ;
$MIN_DISTINCT_INSTS_SCHOLARS_SHARE = .05;
......@@ -276,6 +276,7 @@ foreach ($inst_counts as $key => $value) {
$missing_insts += $value;
}
elseif ($value > $thresh) {
$label = shorter_html_label($label);
$insts_data.='["' . addslashes($label) . '",' . $value . '],';
$n_shown_insts += 1;
$tot_shown_insts += $value;
......@@ -448,7 +449,8 @@ $(document).ready(function() {
tooltip: {
formatter: function() {
return "<b>"+ this.point.name +"</b>: "+ Math.floor(10*this.percentage)/10 +" %";
}
},
useHTML: true
},
plotOptions: {
pie: {
......@@ -496,7 +498,8 @@ $(document).ready(function() {
tooltip: {
formatter: function() {
return "<b>"+ this.point.name +"</b>: "+ Math.floor(10*this.percentage)/10 +" %";
}
},
useHTML: true
},
plotOptions: {
pie: {
......@@ -508,10 +511,12 @@ $(document).ready(function() {
color: "#000000",
connectorColor: "#000000",
formatter: function() {
return "<b>"+ this.point.name +"</b>: "+ Math.floor(10*this.percentage)/10 +" %";
},
useHTML: true
}
console.log("point:",this.point)
var truc = "<b>"+ this.point.name +"</b>: "+ Math.floor(10*this.percentage)/10 +" %"
return truc;
}
},
useHTML: true
}
},
series: [{
......
......@@ -410,13 +410,13 @@ Contributions and ideas are welcome to improve this directory.
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<!-- conditional display (cf. n_shown in stats-prep) -->
<div id="labs_div" class="directory-piechart"></div>
<div id="insts_div" class="directory-piechart"></div>
</div>
</div>
<div class="row chart-row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- conditional display (idem) -->
<div id="insts_div" class="directory-piechart"></div>
<div id="labs_div" class="directory-piechart"></div>
</div>
</div>
</div>
......
......@@ -269,13 +269,13 @@ Contributions and ideas are welcome to improve this directory.
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<!-- conditional display (cf. n_shown in stats-prep) -->
<div id="labs_div" class="directory-piechart"></div>
<div id="insts_div" class="directory-piechart"></div>
</div>
</div>
<div class="row chart-row">
<div class="col-lg-12 col-md-12 col-sm-12">
<!-- conditional display (idem) -->
<div id="insts_div" class="directory-piechart"></div>
<div id="labs_div" class="directory-piechart"></div>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment