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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
e2e95b5f
Commit
e2e95b5f
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
phpcs
parent
a5645b62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/core/class/dolgraph.class.php
+53
-53
53 additions, 53 deletions
htdocs/core/class/dolgraph.class.php
with
53 additions
and
53 deletions
htdocs/core/class/dolgraph.class.php
+
53
−
53
View file @
e2e95b5f
...
...
@@ -65,7 +65,7 @@ class DolGraph
var
$bgcolorgrid
=
array
(
255
,
255
,
255
);
// array(R,G,B)
var
$datacolor
;
// array(array(R,G,B),...)
protected
$
_
stringtoshow
;
// To store string to output graph into HTML page
protected
$stringtoshow
;
// To store string to output graph into HTML page
/**
...
...
@@ -774,7 +774,7 @@ class DolGraph
// Generate file
$graph
->
draw
(
$file
);
$this
->
_
stringtoshow
=
'<!-- Build using '
.
$this
->
_library
.
' --><img src="'
.
$fileurl
.
'" title="'
.
dol_escape_htmltag
(
$this
->
title
?
$this
->
title
:
$this
->
YLabel
)
.
'" alt="'
.
dol_escape_htmltag
(
$this
->
title
?
$this
->
title
:
$this
->
YLabel
)
.
'">'
;
$this
->
stringtoshow
=
'<!-- Build using '
.
$this
->
_library
.
' --><img src="'
.
$fileurl
.
'" title="'
.
dol_escape_htmltag
(
$this
->
title
?
$this
->
title
:
$this
->
YLabel
)
.
'" alt="'
.
dol_escape_htmltag
(
$this
->
title
?
$this
->
title
:
$this
->
YLabel
)
.
'">'
;
}
...
...
@@ -847,18 +847,18 @@ class DolGraph
}
$tag
=
dol_escape_htmltag
(
dol_string_unaccent
(
dol_string_nospecial
(
basename
(
$file
),
'_'
,
array
(
'-'
,
'.'
))));
$this
->
_
stringtoshow
=
'<!-- Build using '
.
$this
->
_library
.
' -->'
.
"
\n
"
;
if
(
!
empty
(
$this
->
title
))
$this
->
_
stringtoshow
.
=
'<div align="center" class="dolgraphtitle'
.
(
empty
(
$this
->
cssprefix
)
?
''
:
' dolgraphtitle'
.
$this
->
cssprefix
)
.
'">'
.
$this
->
title
.
'</div>'
;
$this
->
_
stringtoshow
.
=
'<div id="placeholder_'
.
$tag
.
'" style="width:'
.
$this
->
width
.
'px;height:'
.
$this
->
height
.
'px;" class="dolgraph'
.
(
empty
(
$this
->
cssprefix
)
?
''
:
' dolgraph'
.
$this
->
cssprefix
)
.
'"></div>'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'<script id="'
.
$tag
.
'">'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'$(function () {'
.
"
\n
"
;
$this
->
stringtoshow
=
'<!-- Build using '
.
$this
->
_library
.
' -->'
.
"
\n
"
;
if
(
!
empty
(
$this
->
title
))
$this
->
stringtoshow
.
=
'<div align="center" class="dolgraphtitle'
.
(
empty
(
$this
->
cssprefix
)
?
''
:
' dolgraphtitle'
.
$this
->
cssprefix
)
.
'">'
.
$this
->
title
.
'</div>'
;
$this
->
stringtoshow
.
=
'<div id="placeholder_'
.
$tag
.
'" style="width:'
.
$this
->
width
.
'px;height:'
.
$this
->
height
.
'px;" class="dolgraph'
.
(
empty
(
$this
->
cssprefix
)
?
''
:
' dolgraph'
.
$this
->
cssprefix
)
.
'"></div>'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'<script id="'
.
$tag
.
'">'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'$(function () {'
.
"
\n
"
;
$i
=
$firstlot
;
while
(
$i
<
$nblot
)
{
$this
->
_
stringtoshow
.
=
$serie
[
$i
];
$this
->
stringtoshow
.
=
$serie
[
$i
];
$i
++
;
}
$this
->
_
stringtoshow
.
=
"
\n
"
;
$this
->
stringtoshow
.
=
"
\n
"
;
// Special case for Graph of type 'pie'
if
(
isset
(
$this
->
type
[
$firstlot
])
&&
$this
->
type
[
$firstlot
]
==
'pie'
)
...
...
@@ -871,7 +871,7 @@ class DolGraph
$showpointvalue
=
$this
->
showpointvalue
;
$showpercent
=
$this
->
showpercent
;
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
function plotWithOptions_'
.
$tag
.
'() {
$.plot($("#placeholder_'
.
$tag
.
'"), d0,
{
...
...
@@ -886,15 +886,15 @@ class DolGraph
var percent=Math.round(series.percent);
var number=series.data[0][1];
return \''
;
$this
->
_
stringtoshow
.
=
'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'
;
if
(
$urltemp
)
$this
->
_
stringtoshow
.
=
'<a style="color: #FFFFFF;" border="0" href="'
.
$urltemp
.
'">'
;
$this
->
_
stringtoshow
.
=
'\'+'
;
$this
->
_
stringtoshow
.
=
(
$showlegend
?
''
:
'label+\'<br/>\'+'
);
// Hide label if already shown in legend
$this
->
_
stringtoshow
.
=
(
$showpointvalue
?
'number+'
:
''
);
$this
->
_
stringtoshow
.
=
(
$showpercent
?
'\'<br/>\'+percent+\'%\'+'
:
''
);
$this
->
_
stringtoshow
.
=
'\''
;
if
(
$urltemp
)
$this
->
_
stringtoshow
.
=
'</a>'
;
$this
->
_
stringtoshow
.
=
'</div>\';
$this
->
stringtoshow
.
=
'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'
;
if
(
$urltemp
)
$this
->
stringtoshow
.
=
'<a style="color: #FFFFFF;" border="0" href="'
.
$urltemp
.
'">'
;
$this
->
stringtoshow
.
=
'\'+'
;
$this
->
stringtoshow
.
=
(
$showlegend
?
''
:
'label+\'<br/>\'+'
);
// Hide label if already shown in legend
$this
->
stringtoshow
.
=
(
$showpointvalue
?
'number+'
:
''
);
$this
->
stringtoshow
.
=
(
$showpercent
?
'\'<br/>\'+percent+\'%\'+'
:
''
);
$this
->
stringtoshow
.
=
'\''
;
if
(
$urltemp
)
$this
->
stringtoshow
.
=
'</a>'
;
$this
->
stringtoshow
.
=
'</div>\';
},
background: {
opacity: 0.5,
...
...
@@ -911,9 +911,9 @@ class DolGraph
},'
;
if
(
count
(
$datacolor
))
{
$this
->
_
stringtoshow
.
=
'colors: '
.
(
!
empty
(
$data
[
'seriescolor'
])
?
json_encode
(
$data
[
'seriescolor'
])
:
json_encode
(
$datacolor
))
.
','
;
$this
->
stringtoshow
.
=
'colors: '
.
(
!
empty
(
$data
[
'seriescolor'
])
?
json_encode
(
$data
[
'seriescolor'
])
:
json_encode
(
$datacolor
))
.
','
;
}
$this
->
_
stringtoshow
.
=
'legend: {show: '
.
(
$showlegend
?
'true'
:
'false'
)
.
', position: \'ne\' }
$this
->
stringtoshow
.
=
'legend: {show: '
.
(
$showlegend
?
'true'
:
'false'
)
.
', position: \'ne\' }
});
}'
.
"
\n
"
;
}
...
...
@@ -921,7 +921,7 @@ class DolGraph
else
{
// Add code to support tooltips
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
function showTooltip_'
.
$tag
.
'(x, y, contents) {
$(\'<div id="tooltip_'
.
$tag
.
'">\' + contents + \'</div>\').css({
position: \'absolute\',
...
...
@@ -935,26 +935,26 @@ class DolGraph
opacity: 0.80
}).appendTo("body").fadeIn(20);
}
var previousPoint = null;
$("#placeholder_'
.
$tag
.
'").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
/* console.log(item); */
var x = item.datapoint[0].toFixed(2);
var y = item.datapoint[1].toFixed(2);
var z = item.series.xaxis.ticks[item.dataIndex].label;
'
;
if
(
$this
->
showpointvalue
>
0
)
$this
->
_
stringtoshow
.
=
'
if
(
$this
->
showpointvalue
>
0
)
$this
->
stringtoshow
.
=
'
showTooltip_'
.
$tag
.
'(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
'
;
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
}
}
else {
...
...
@@ -964,50 +964,50 @@ class DolGraph
});
'
;
$this
->
_
stringtoshow
.
=
'var stack = null, steps = false;'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'var stack = null, steps = false;'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'function plotWithOptions_'
.
$tag
.
'() {'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'$.plot($("#placeholder_'
.
$tag
.
'"), [ '
.
"
\n
"
;
$this
->
stringtoshow
.
=
'function plotWithOptions_'
.
$tag
.
'() {'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'$.plot($("#placeholder_'
.
$tag
.
'"), [ '
.
"
\n
"
;
$i
=
$firstlot
;
while
(
$i
<
$nblot
)
{
if
(
$i
>
$firstlot
)
$this
->
_
stringtoshow
.
=
', '
.
"
\n
"
;
if
(
$i
>
$firstlot
)
$this
->
stringtoshow
.
=
', '
.
"
\n
"
;
$color
=
sprintf
(
"%02x%02x%02x"
,
$this
->
datacolor
[
$i
][
0
],
$this
->
datacolor
[
$i
][
1
],
$this
->
datacolor
[
$i
][
2
]);
$this
->
_
stringtoshow
.
=
'{ '
;
if
(
!
isset
(
$this
->
type
[
$i
])
||
$this
->
type
[
$i
]
==
'bars'
)
$this
->
_
stringtoshow
.
=
'bars: { show: true, align: "'
.
(
$i
==
$firstlot
?
'center'
:
'left'
)
.
'", barWidth: 0.5 }, '
;
if
(
isset
(
$this
->
type
[
$i
])
&&
$this
->
type
[
$i
]
==
'lines'
)
$this
->
_
stringtoshow
.
=
'lines: { show: true, fill: false }, '
;
$this
->
_
stringtoshow
.
=
'color: "#'
.
$color
.
'", label: "'
.
(
isset
(
$this
->
Legend
[
$i
])
?
dol_escape_js
(
$this
->
Legend
[
$i
])
:
''
)
.
'", data: d'
.
$i
.
' }'
;
$this
->
stringtoshow
.
=
'{ '
;
if
(
!
isset
(
$this
->
type
[
$i
])
||
$this
->
type
[
$i
]
==
'bars'
)
$this
->
stringtoshow
.
=
'bars: { show: true, align: "'
.
(
$i
==
$firstlot
?
'center'
:
'left'
)
.
'", barWidth: 0.5 }, '
;
if
(
isset
(
$this
->
type
[
$i
])
&&
$this
->
type
[
$i
]
==
'lines'
)
$this
->
stringtoshow
.
=
'lines: { show: true, fill: false }, '
;
$this
->
stringtoshow
.
=
'color: "#'
.
$color
.
'", label: "'
.
(
isset
(
$this
->
Legend
[
$i
])
?
dol_escape_js
(
$this
->
Legend
[
$i
])
:
''
)
.
'", data: d'
.
$i
.
' }'
;
$i
++
;
}
$this
->
_
stringtoshow
.
=
"
\n
"
.
' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'
.
"
\n
"
;
$this
->
stringtoshow
.
=
"
\n
"
.
' ], { series: { stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'
.
"
\n
"
;
// Xaxis
$this
->
_
stringtoshow
.
=
', xaxis: { ticks: ['
.
"
\n
"
;
$this
->
stringtoshow
.
=
', xaxis: { ticks: ['
.
"
\n
"
;
$x
=
0
;
foreach
(
$this
->
data
as
$key
=>
$valarray
)
{
if
(
$x
>
0
)
$this
->
_
stringtoshow
.
=
', '
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
' ['
.
$x
.
', "'
.
$valarray
[
0
]
.
'"]'
;
if
(
$x
>
0
)
$this
->
stringtoshow
.
=
', '
.
"
\n
"
;
$this
->
stringtoshow
.
=
' ['
.
$x
.
', "'
.
$valarray
[
0
]
.
'"]'
;
$x
++
;
}
$this
->
_
stringtoshow
.
=
'] }'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'] }'
.
"
\n
"
;
// Yaxis
$this
->
_
stringtoshow
.
=
', yaxis: { min: '
.
$this
->
MinValue
.
', max: '
.
(
$this
->
MaxValue
)
.
' }'
.
"
\n
"
;
$this
->
stringtoshow
.
=
', yaxis: { min: '
.
$this
->
MinValue
.
', max: '
.
(
$this
->
MaxValue
)
.
' }'
.
"
\n
"
;
// Background color
$color1
=
sprintf
(
"%02x%02x%02x"
,
$this
->
bgcolorgrid
[
0
],
$this
->
bgcolorgrid
[
0
],
$this
->
bgcolorgrid
[
2
]);
$color2
=
sprintf
(
"%02x%02x%02x"
,
$this
->
bgcolorgrid
[
0
],
$this
->
bgcolorgrid
[
1
],
$this
->
bgcolorgrid
[
2
]);
$this
->
_
stringtoshow
.
=
', grid: { hoverable: true, backgroundColor: { colors: ["#'
.
$color1
.
'", "#'
.
$color2
.
'"] } }'
.
"
\n
"
;
//$this->
_
stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this
->
_
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'}'
.
"
\n
"
;
$this
->
stringtoshow
.
=
', grid: { hoverable: true, backgroundColor: { colors: ["#'
.
$color1
.
'", "#'
.
$color2
.
'"] } }'
.
"
\n
"
;
//$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this
->
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'}'
.
"
\n
"
;
}
$this
->
_
stringtoshow
.
=
'plotWithOptions_'
.
$tag
.
'();'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'</script>'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'plotWithOptions_'
.
$tag
.
'();'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'</script>'
.
"
\n
"
;
}
...
...
@@ -1019,10 +1019,10 @@ class DolGraph
*/
function
show
()
{
return
$this
->
_
stringtoshow
;
return
$this
->
stringtoshow
;
}
/**
* getDefaultGraphSizeForStats
*
...
...
@@ -1033,18 +1033,18 @@ class DolGraph
static
function
getDefaultGraphSizeForStats
(
$direction
,
$defaultsize
=
''
)
{
global
$conf
;
if
(
$direction
==
'width'
)
{
if
(
empty
(
$conf
->
dol_optimize_smallscreen
))
return
(
$defaultsize
?
$defaultsize
:
'500'
);
else
return
(
empty
(
$_SESSION
[
'dol_screen_width'
])
?
'280'
:
(
$_SESSION
[
'dol_screen_width'
]
-
40
));
}
if
(
$direction
==
'height'
)
if
(
$direction
==
'height'
)
{
return
(
empty
(
$conf
->
dol_optimize_smallscreen
)
?
(
$defaultsize
?
$defaultsize
:
'200'
)
:
'160'
);
}
return
0
;
}
}
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