Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
3bde2028
Commit
3bde2028
authored
Mar 14, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better colors in directory stats
parent
72859dbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
15 deletions
+31
-15
stat-prep_from_array.php
php_library/stat-prep_from_array.php
+31
-15
No files found.
php_library/stat-prep_from_array.php
View file @
3bde2028
...
@@ -13,6 +13,14 @@ $MIN_DISTINCT_LABS_SCHOLARS_SHARE = .25;
...
@@ -13,6 +13,14 @@ $MIN_DISTINCT_LABS_SCHOLARS_SHARE = .25;
$MIN_DISTINCT_INSTS
=
1
;
$MIN_DISTINCT_INSTS
=
1
;
$MIN_DISTINCT_INSTS_SCHOLARS_SHARE
=
.
20
;
$MIN_DISTINCT_INSTS_SCHOLARS_SHARE
=
.
20
;
// always the same colors for "others" and "missing" categories
$COLOR_OTHERS
=
"grey"
;
$COLOR_MISSING
=
"darkgrey"
;
// all the other available color-scheme
$COLOR_SCHEME
=
'["#4572A7", "#AA4643", "#89A54E", "#80699B", "#3D96AE",
"#DB843D", "#92A8CD", "#A47D7C", "#B5CA92"]'
;
// main vars
// main vars
...
@@ -33,6 +41,8 @@ $missing_title = 0;
...
@@ -33,6 +41,8 @@ $missing_title = 0;
$missing_position
=
0
;
$missing_position
=
0
;
$missing_labs
=
0
;
$missing_labs
=
0
;
$missing_insts
=
0
;
$missing_insts
=
0
;
// données des pays
// données des pays
foreach
(
$scholars
as
$row
)
{
foreach
(
$scholars
as
$row
)
{
...
@@ -150,10 +160,10 @@ foreach ($country_list as $key => $value) {
...
@@ -150,10 +160,10 @@ foreach ($country_list as $key => $value) {
}
}
//if (false) {
//if (false) {
if
(
$missing_country
>
0
){
if
(
$missing_country
>
0
){
$country_data
.=
'
["Missing data",'
.
$missing_country
.
']
,'
;
$country_data
.=
'
{"name":"Missing data", "y":'
.
$missing_country
.
', "color":"'
.
$COLOR_MISSING
.
'"}
,'
;
}
}
if
(
$other_country
>
0
){
if
(
$other_country
>
0
){
$country_data
.=
'
["Others",'
.
$other_country
.
']
'
;
$country_data
.=
'
{"name":"Others", "y":'
.
$other_country
.
', "color":"'
.
$COLOR_OTHERS
.
'"}
'
;
}
else
{
}
else
{
$country_data
=
substr
(
$country_data
,
0
,
-
1
);
$country_data
=
substr
(
$country_data
,
0
,
-
1
);
}
}
...
@@ -176,10 +186,10 @@ foreach ($position_list as $key => $value) {
...
@@ -176,10 +186,10 @@ foreach ($position_list as $key => $value) {
//
//
//if (false) {
//if (false) {
if
(
$missing_position
>
0
){
if
(
$missing_position
>
0
){
$position_data
.=
'
["Missing data",'
.
$missing_position
.
']
,'
;
$position_data
.=
'
{"name":"Missing data", "y":'
.
$missing_position
.
', "color":"'
.
$COLOR_MISSING
.
'"}
,'
;
}
}
if
(
$other_position
>
0
){
if
(
$other_position
>
0
){
$position_data
.=
'
["Others",'
.
$other_position
.
']
'
;
$position_data
.=
'
{"name":"Others", "y":'
.
$other_position
.
', "color":"'
.
$COLOR_OTHERS
.
'"}
'
;
}
else
{
}
else
{
$position_data
=
substr
(
$position_data
,
0
,
-
1
);
$position_data
=
substr
(
$position_data
,
0
,
-
1
);
}
}
...
@@ -197,10 +207,10 @@ foreach ($title_list as $key => $value) {
...
@@ -197,10 +207,10 @@ foreach ($title_list as $key => $value) {
}
}
//if (false) {
//if (false) {
if
(
$missing_title
>
0
){
if
(
$missing_title
>
0
){
$title_data
.=
'
["Missing data",'
.
$missing_title
.
']
,'
;
$title_data
.=
'
{"name":"Missing data", "y":'
.
$missing_title
.
', "color":"'
.
$COLOR_MISSING
.
'"}
,'
;
}
}
if
(
$other_title
>
0
){
if
(
$other_title
>
0
){
$title_data
.=
'
["Others",'
.
$other_title
.
']
'
;
$title_data
.=
'
{"name":"Others", "y":'
.
$other_title
.
', "color":"'
.
$COLOR_OTHERS
.
'"}
'
;
}
else
{
}
else
{
$title_data
=
substr
(
$title_data
,
0
,
-
1
);
$title_data
=
substr
(
$title_data
,
0
,
-
1
);
}
}
...
@@ -231,12 +241,13 @@ foreach ($lab_counts as $key => $value) {
...
@@ -231,12 +241,13 @@ foreach ($lab_counts as $key => $value) {
# doesn't include missing, but we can compare to n_scholars to know
# doesn't include missing, but we can compare to n_scholars to know
$labs_total_responses
+=
$value
;
$labs_total_responses
+=
$value
;
}
}
if
(
$missing_labs
>
0
){
if
(
$missing_labs
>
0
){
$labs_data
.=
'
["Missing data",'
.
$missing_labs
.
']
,'
;
$labs_data
.=
'
{"name":"Missing data", "y":'
.
$missing_labs
.
', "color":"'
.
$COLOR_MISSING
.
'"}
,'
;
}
}
if
(
$other_labs
>
0
){
if
(
$other_labs
>
0
){
$labs_data
.=
'
["Others",'
.
$other_labs
.
']
'
;
$labs_data
.=
'
{"name":"Others", "y":'
.
$other_labs
.
', "color":"'
.
$COLOR_OTHERS
.
'"}
'
;
}
else
{
}
else
{
$labs_data
=
substr
(
$labs_data
,
0
,
-
1
);
$labs_data
=
substr
(
$labs_data
,
0
,
-
1
);
}
}
...
@@ -271,10 +282,10 @@ foreach ($inst_counts as $key => $value) {
...
@@ -271,10 +282,10 @@ foreach ($inst_counts as $key => $value) {
}
}
if
(
$missing_insts
>
0
){
if
(
$missing_insts
>
0
){
$insts_data
.=
'
["Missing data",'
.
$missing_insts
.
']
,'
;
$insts_data
.=
'
{"name":"Missing data", "y":'
.
$missing_insts
.
', "color":"'
.
$COLOR_MISSING
.
'"}
,'
;
}
}
if
(
$other_labs
>
0
){
if
(
$other_labs
>
0
){
$insts_data
.=
'
["Others",'
.
$other_insts
.
']
'
;
$insts_data
.=
'
{"name":"Others", "y":'
.
$other_insts
.
', "color":"'
.
$COLOR_OTHERS
.
'"}
'
;
}
else
{
}
else
{
// removes the last ',' from line 257 or 264
// removes the last ',' from line 257 or 264
$insts_data
=
substr
(
$insts_data
,
0
,
-
1
);
$insts_data
=
substr
(
$insts_data
,
0
,
-
1
);
...
@@ -300,7 +311,8 @@ $(document).ready(function() {
...
@@ -300,7 +311,8 @@ $(document).ready(function() {
renderTo: "country",
renderTo: "country",
plotBackgroundColor: null,
plotBackgroundColor: null,
plotBorderWidth: null,
plotBorderWidth: null,
plotShadow: false
plotShadow: false,
colors: '
.
$COLOR_SCHEME
.
'
},
},
title: {
title: {
text: "Countries"
text: "Countries"
...
@@ -336,7 +348,8 @@ $(document).ready(function() {
...
@@ -336,7 +348,8 @@ $(document).ready(function() {
renderTo: "position",
renderTo: "position",
plotBackgroundColor: null,
plotBackgroundColor: null,
plotBorderWidth: null,
plotBorderWidth: null,
plotShadow: false
plotShadow: false,
colors: '
.
$COLOR_SCHEME
.
'
},
},
title: {
title: {
text: "Position of scholars"
text: "Position of scholars"
...
@@ -371,7 +384,8 @@ $(document).ready(function() {
...
@@ -371,7 +384,8 @@ $(document).ready(function() {
renderTo: "title",
renderTo: "title",
plotBackgroundColor: null,
plotBackgroundColor: null,
plotBorderWidth: null,
plotBorderWidth: null,
plotShadow: false
plotShadow: false,
colors: '
.
$COLOR_SCHEME
.
'
},
},
title: {
title: {
text: "Title of scholars"
text: "Title of scholars"
...
@@ -414,7 +428,8 @@ $(document).ready(function() {
...
@@ -414,7 +428,8 @@ $(document).ready(function() {
renderTo: "labs_div",
renderTo: "labs_div",
plotBackgroundColor: null,
plotBackgroundColor: null,
plotBorderWidth: null,
plotBorderWidth: null,
plotShadow: false
plotShadow: false,
colors: '
.
$COLOR_SCHEME
.
'
},
},
title: {
title: {
text: "Laboratories affiliations"
text: "Laboratories affiliations"
...
@@ -459,7 +474,8 @@ $(document).ready(function() {
...
@@ -459,7 +474,8 @@ $(document).ready(function() {
renderTo: "insts_div",
renderTo: "insts_div",
plotBackgroundColor: null,
plotBackgroundColor: null,
plotBorderWidth: null,
plotBorderWidth: null,
plotShadow: false
plotShadow: false,
colors: '
.
$COLOR_SCHEME
.
'
},
},
title: {
title: {
text: "Institutional affiliations"
text: "Institutional affiliations"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment