Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
0face58c
Commit
0face58c
authored
May 21, 2011
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Support stack bars for flot graphs
parent
32007f35
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/adherents/index.php
+38
-8
38 additions, 8 deletions
htdocs/adherents/index.php
htdocs/lib/functions.lib.php
+87
-12
87 additions, 12 deletions
htdocs/lib/functions.lib.php
htdocs/societe/index.php
+5
-4
5 additions, 4 deletions
htdocs/societe/index.php
with
130 additions
and
24 deletions
htdocs/adherents/index.php
+
38
−
8
View file @
0face58c
...
...
@@ -137,15 +137,49 @@ print '</td></tr>';
print
"</table></form>"
;
print
'</td><td class="notopnoleftnoright" valign="top">'
;
$var
=
true
;
print
'<table class="noborder" width="100%">'
;
print
'<tr class="liste_titre"><td colspan="2">'
.
$langs
->
trans
(
"Statistics"
)
.
'</td></tr>'
;
print
'<tr><td align="center">'
;
$SommeA
=
0
;
$SommeB
=
0
;
$SommeC
=
0
;
$SommeD
=
0
;
$dataval
=
array
();
$datalabels
=
array
();
foreach
(
$AdherentType
as
$key
=>
$adhtype
)
{
$datalabels
[]
=
$adhtype
->
getNomUrl
(
0
,
dol_size
(
16
));
$dataval
[
'draft'
][]
=
isset
(
$MemberToValidate
[
$key
])
?
$MemberToValidate
[
$key
]
:
0
;
$dataval
[
'notuptodate'
][]
=
isset
(
$MembersValidated
[
$key
])
?
$MembersValidated
[
$key
]
-
$MemberUpToDate
[
$key
]
:
0
;
$dataval
[
'uptodate'
][]
=
isset
(
$MemberUpToDate
[
$key
])
?
$MemberUpToDate
[
$key
]
:
0
;
$dataval
[
'resiliated'
][]
=
isset
(
$MembersResiliated
[
$key
])
?
$MembersResiliated
[
$key
]
:
0
;
$SommeA
+=
isset
(
$MemberToValidate
[
$key
])
?
$MemberToValidate
[
$key
]
:
0
;
$SommeB
+=
isset
(
$MembersValidated
[
$key
])
?
$MembersValidated
[
$key
]
-
$MemberUpToDate
[
$key
]
:
0
;
$SommeC
+=
isset
(
$MemberUpToDate
[
$key
])
?
$MemberUpToDate
[
$key
]
:
0
;
$SommeD
+=
isset
(
$MembersResiliated
[
$key
])
?
$MembersResiliated
[
$key
]
:
0
;
}
/*
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'values'=> $dataval['draft']);
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'values'=> $dataval['notuptodate']);
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'values'=> $dataval['uptodate']);
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'values'=> $dataval['resiliated']);
$data=array('series'=>$dataseries,'xlabel'=>$datalabels);
dol_print_graph('stats',300,180,$data,1,'bar');
*/
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"MenuMembersNotUpToDate"
),
'values'
=>
array
(
round
(
$SommeB
)));
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"MenuMembersUpToDate"
),
'values'
=>
array
(
round
(
$SommeC
)));
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"MembersStatusResiliated"
),
'values'
=>
array
(
round
(
$SommeD
)));
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"MembersStatusToValid"
),
'values'
=>
array
(
round
(
$SommeA
)));
$data
=
array
(
'series'
=>
$dataseries
);
dol_print_graph
(
'stats'
,
300
,
180
,
$data
,
1
,
'pie'
);
print
'</td></tr>'
;
print
'</table>'
;
print
'</td><td class="notopnoleftnoright" valign="top">'
;
$var
=
true
;
// Summary of members by type
print
'<table class="noborder" width="100%">'
;
...
...
@@ -167,10 +201,6 @@ foreach ($AdherentType as $key => $adhtype)
print
'<td align="right">'
.
(
isset
(
$MemberUpToDate
[
$key
])
&&
$MemberUpToDate
[
$key
]
>
0
?
$MemberUpToDate
[
$key
]
:
''
)
.
' '
.
$staticmember
->
LibStatut
(
1
,
$adhtype
->
cotisation
,
gmmktime
(),
3
)
.
'</td>'
;
print
'<td align="right">'
.
(
isset
(
$MembersResiliated
[
$key
])
&&
$MembersResiliated
[
$key
]
>
0
?
$MembersResiliated
[
$key
]
:
''
)
.
' '
.
$staticmember
->
LibStatut
(
0
,
$adhtype
->
cotisation
,
0
,
3
)
.
'</td>'
;
print
"</tr>
\n
"
;
$SommeA
+=
isset
(
$MemberToValidate
[
$key
])
?
$MemberToValidate
[
$key
]
:
0
;
$SommeB
+=
isset
(
$MembersValidated
[
$key
])
?
$MembersValidated
[
$key
]
-
$MemberUpToDate
[
$key
]
:
0
;
$SommeC
+=
isset
(
$MemberUpToDate
[
$key
])
?
$MemberUpToDate
[
$key
]
:
0
;
$SommeD
+=
isset
(
$MembersResiliated
[
$key
])
?
$MembersResiliated
[
$key
]
:
0
;
}
print
'<tr class="liste_total">'
;
print
'<td class="liste_total">'
.
$langs
->
trans
(
"Total"
)
.
'</td>'
;
...
...
...
...
This diff is collapsed.
Click to expand it.
htdocs/lib/functions.lib.php
+
87
−
12
View file @
0face58c
...
...
@@ -1234,7 +1234,8 @@ function dolibarr_trunc($string,$size=40,$trunc='right',$stringencoding='')
* @param width Width in pixel
* @param height Height in pixel
* @param data Data array
* @param type Type of graph
* @param showlegend Show legend
* @param type Type of graph (pie, bar, line)
*/
function
dol_print_graph
(
$htmlid
,
$width
,
$height
,
$data
,
$showlegend
=
0
,
$type
=
'pie'
)
{
...
...
@@ -1264,20 +1265,24 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
{
if
(
$type
==
'pie'
)
{
print
'<script type="text/javascript">
// data is array('series'=>array(0=>serie1,1=>serie2,...));
// serie is array('label'=>'label', values=>array(0=>val))
print
'
<script type="text/javascript">
jQuery(function () {
var data = ['
.
"
\n
"
;
$i
=
0
;
foreach
(
$data
as
$serie
)
foreach
(
$data
[
'series'
]
as
$serie
)
{
//print '{ label: "'.($showlegend?$serie['values'][0]:$serie['label'].'<br>'.$serie['values'][0]).'", data: '.$serie['values'][0].' }';
print
'{ label: "'
.
(
$showlegend
?
$serie
[
'label'
]
.
'<br>'
.
$serie
[
'values'
][
0
]
:
$serie
[
'label'
]
.
'<br>'
.
$serie
[
'values'
][
0
])
.
'", data: '
.
$serie
[
'values'
][
0
]
.
' }'
;
if
(
$i
<
sizeof
(
$serie
))
print
','
;
print
'{ label: "'
.
dol_escape_js
(
$serie
[
'label'
])
.
'", data: '
.
$serie
[
'values'
][
0
]
.
' }'
;
if
(
$i
<
sizeof
(
$
data
[
'
serie
s'
]
))
print
','
;
print
"
\n
"
;
$i
++
;
}
print
'];
function plotWithOptions() {
jQuery.plot(jQuery("#'
.
$htmlid
.
'"), data,
{
series: {pie: {
...
...
@@ -1287,9 +1292,11 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
show: true,
radius: 3/4,
formatter: function(label, series) {
return \'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">\'+label
/* +\'<br/>\'+Math.round(series.percent)*/
+\'</div>\';
var percent=Math.round(series.percent);
var number=series.data[0][1];
return \'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">\'+'
.
(
$showlegend
?
'number'
:
'label+\'<br/>\'+number'
);
if
(
!
empty
(
$showpercent
))
print
'+\'<br/>\'+percent'
;
print
'+\'</div>\';
},
background: {
opacity: 0.5,
...
...
@@ -1312,9 +1319,77 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
}
print
'legend: {show: '
.
(
$showlegend
?
'true'
:
'false'
)
.
'}
});
}
plotWithOptions();
});
</script>'
;
}
else
if
(
$type
==
'bar'
)
{
// data is array('series'=>array(0=>serie1,1=>serie2,...),'xlabel'=>array(0=>label1,1=>label2,...));
// serie is array('label'=>'label', values=>array(0=>val1,1=>val2,...))
print
'
<script type="text/javascript">
jQuery(function () {
var data = ['
;
$i
=
1
;
foreach
(
$data
[
'series'
]
as
$serie
)
{
print
'{label: \''
.
dol_escape_js
(
$serie
[
'label'
])
.
'\', data: ['
;
$j
=
1
;
foreach
(
$serie
[
'values'
]
as
$val
)
{
print
'['
.
$j
.
','
.
$val
.
']'
;
if
(
$j
<
sizeof
(
$serie
[
'values'
]))
print
', '
;
$j
++
;
}
print
']}'
;
if
(
$i
<
sizeof
(
$data
[
'series'
]))
print
','
;
$i
++
;
}
print
'];
var dataticks = ['
;
$i
=
1
;
foreach
(
$data
[
'xlabel'
]
as
$label
)
{
print
'['
.
$i
.
',\''
.
$label
.
'\']'
;
if
(
$i
<
sizeof
(
$data
[
'xlabel'
]))
print
','
;
$i
++
;
}
print
'];
var stack = 0, bars = true, lines = false, steps = false;
function plotWithOptions() {
jQuery.plot(jQuery("#'
.
$htmlid
.
'"), data,
{
series: {
stack: stack,
lines: { show: lines, fill: true, steps: steps },
bars: { show: bars, barWidth: 0.9, align: \'center\' }
},
'
;
if
(
sizeof
(
$datacolor
))
{
print
'colors: ['
;
$j
=
0
;
foreach
(
$datacolor
as
$val
)
{
print
'"'
.
$val
.
'"'
;
if
(
$j
<
sizeof
(
$datacolor
))
print
','
;
$j
++
;
}
print
'], '
;
}
print
'legend: {show: '
.
(
$showlegend
?
'true'
:
'false'
)
.
'},
xaxis: {ticks: dataticks},
});
}
plotWithOptions();
});
</script>'
;
}
else
print
'BadValueForPArameterType'
;
}
}
...
...
...
...
This diff is collapsed.
Click to expand it.
htdocs/societe/index.php
+
5
−
4
View file @
0face58c
...
...
@@ -103,10 +103,11 @@ print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</
if
(
$conf
->
use_javascript_ajax
&&
((
round
(
$third
[
'prospect'
])
?
1
:
0
)
+
(
round
(
$third
[
'customer'
])
?
1
:
0
)
+
(
round
(
$third
[
'supplier'
])
?
1
:
0
)
>=
2
))
{
print
'<tr><td align="center">'
;
$data
=
array
();
if
(
$conf
->
societe
->
enabled
&&
empty
(
$conf
->
global
->
SOCIETE_DISABLE_PROSPECTS
))
$data
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Prospects"
),
'values'
=>
array
(
round
(
$third
[
'prospect'
])));
if
(
$conf
->
societe
->
enabled
&&
empty
(
$conf
->
global
->
SOCIETE_DISABLE_CUSTOMERS
))
$data
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Customers"
),
'values'
=>
array
(
round
(
$third
[
'customer'
])));
if
(
$conf
->
fournisseur
->
enabled
)
$data
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Suppliers"
),
'values'
=>
array
(
round
(
$third
[
'supplier'
])));
$dataseries
=
array
();
if
(
$conf
->
societe
->
enabled
&&
empty
(
$conf
->
global
->
SOCIETE_DISABLE_PROSPECTS
))
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Prospects"
),
'values'
=>
array
(
round
(
$third
[
'prospect'
])));
if
(
$conf
->
societe
->
enabled
&&
empty
(
$conf
->
global
->
SOCIETE_DISABLE_CUSTOMERS
))
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Customers"
),
'values'
=>
array
(
round
(
$third
[
'customer'
])));
if
(
$conf
->
fournisseur
->
enabled
)
$dataseries
[]
=
array
(
'label'
=>
$langs
->
trans
(
"Suppliers"
),
'values'
=>
array
(
round
(
$third
[
'supplier'
])));
$data
=
array
(
'series'
=>
$dataseries
);
dol_print_graph
(
'stats'
,
300
,
180
,
$data
,
0
,
'pie'
);
print
'</td></tr>'
;
}
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment