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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
e2e95b5f
Commit
e2e95b5f
authored
Mar 11, 2015
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
phpcs
parent
a5645b62
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show 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
...
@@ -65,7 +65,7 @@ class DolGraph
var
$bgcolorgrid
=
array
(
255
,
255
,
255
);
// array(R,G,B)
var
$bgcolorgrid
=
array
(
255
,
255
,
255
);
// array(R,G,B)
var
$datacolor
;
// array(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
...
@@ -774,7 +774,7 @@ class DolGraph
// Generate file
// Generate file
$graph
->
draw
(
$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
...
@@ -847,18 +847,18 @@ class DolGraph
}
}
$tag
=
dol_escape_htmltag
(
dol_string_unaccent
(
dol_string_nospecial
(
basename
(
$file
),
'_'
,
array
(
'-'
,
'.'
))));
$tag
=
dol_escape_htmltag
(
dol_string_unaccent
(
dol_string_nospecial
(
basename
(
$file
),
'_'
,
array
(
'-'
,
'.'
))));
$this
->
_
stringtoshow
=
'<!-- Build using '
.
$this
->
_library
.
' -->'
.
"
\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>'
;
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
.
=
'<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
.
=
'<script id="'
.
$tag
.
'">'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'$(function () {'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'$(function () {'
.
"
\n
"
;
$i
=
$firstlot
;
$i
=
$firstlot
;
while
(
$i
<
$nblot
)
while
(
$i
<
$nblot
)
{
{
$this
->
_
stringtoshow
.
=
$serie
[
$i
];
$this
->
stringtoshow
.
=
$serie
[
$i
];
$i
++
;
$i
++
;
}
}
$this
->
_
stringtoshow
.
=
"
\n
"
;
$this
->
stringtoshow
.
=
"
\n
"
;
// Special case for Graph of type 'pie'
// Special case for Graph of type 'pie'
if
(
isset
(
$this
->
type
[
$firstlot
])
&&
$this
->
type
[
$firstlot
]
==
'pie'
)
if
(
isset
(
$this
->
type
[
$firstlot
])
&&
$this
->
type
[
$firstlot
]
==
'pie'
)
...
@@ -871,7 +871,7 @@ class DolGraph
...
@@ -871,7 +871,7 @@ class DolGraph
$showpointvalue
=
$this
->
showpointvalue
;
$showpointvalue
=
$this
->
showpointvalue
;
$showpercent
=
$this
->
showpercent
;
$showpercent
=
$this
->
showpercent
;
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
function plotWithOptions_'
.
$tag
.
'() {
function plotWithOptions_'
.
$tag
.
'() {
$.plot($("#placeholder_'
.
$tag
.
'"), d0,
$.plot($("#placeholder_'
.
$tag
.
'"), d0,
{
{
...
@@ -886,15 +886,15 @@ class DolGraph
...
@@ -886,15 +886,15 @@ class DolGraph
var percent=Math.round(series.percent);
var percent=Math.round(series.percent);
var number=series.data[0][1];
var number=series.data[0][1];
return \''
;
return \''
;
$this
->
_
stringtoshow
.
=
'<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'
;
$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
.
'">'
;
if
(
$urltemp
)
$this
->
stringtoshow
.
=
'<a style="color: #FFFFFF;" border="0" href="'
.
$urltemp
.
'">'
;
$this
->
_
stringtoshow
.
=
'\'+'
;
$this
->
stringtoshow
.
=
'\'+'
;
$this
->
_
stringtoshow
.
=
(
$showlegend
?
''
:
'label+\'<br/>\'+'
);
// Hide label if already shown in legend
$this
->
stringtoshow
.
=
(
$showlegend
?
''
:
'label+\'<br/>\'+'
);
// Hide label if already shown in legend
$this
->
_
stringtoshow
.
=
(
$showpointvalue
?
'number+'
:
''
);
$this
->
stringtoshow
.
=
(
$showpointvalue
?
'number+'
:
''
);
$this
->
_
stringtoshow
.
=
(
$showpercent
?
'\'<br/>\'+percent+\'%\'+'
:
''
);
$this
->
stringtoshow
.
=
(
$showpercent
?
'\'<br/>\'+percent+\'%\'+'
:
''
);
$this
->
_
stringtoshow
.
=
'\''
;
$this
->
stringtoshow
.
=
'\''
;
if
(
$urltemp
)
$this
->
_
stringtoshow
.
=
'</a>'
;
if
(
$urltemp
)
$this
->
stringtoshow
.
=
'</a>'
;
$this
->
_
stringtoshow
.
=
'</div>\';
$this
->
stringtoshow
.
=
'</div>\';
},
},
background: {
background: {
opacity: 0.5,
opacity: 0.5,
...
@@ -911,9 +911,9 @@ class DolGraph
...
@@ -911,9 +911,9 @@ class DolGraph
},'
;
},'
;
if
(
count
(
$datacolor
))
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
"
;
}'
.
"
\n
"
;
}
}
...
@@ -921,7 +921,7 @@ class DolGraph
...
@@ -921,7 +921,7 @@ class DolGraph
else
else
{
{
// Add code to support tooltips
// Add code to support tooltips
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
function showTooltip_'
.
$tag
.
'(x, y, contents) {
function showTooltip_'
.
$tag
.
'(x, y, contents) {
$(\'<div id="tooltip_'
.
$tag
.
'">\' + contents + \'</div>\').css({
$(\'<div id="tooltip_'
.
$tag
.
'">\' + contents + \'</div>\').css({
position: \'absolute\',
position: \'absolute\',
...
@@ -951,10 +951,10 @@ class DolGraph
...
@@ -951,10 +951,10 @@ class DolGraph
var y = item.datapoint[1].toFixed(2);
var y = item.datapoint[1].toFixed(2);
var z = item.series.xaxis.ticks[item.dataIndex].label;
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);
showTooltip_'
.
$tag
.
'(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
'
;
'
;
$this
->
_
stringtoshow
.
=
'
$this
->
stringtoshow
.
=
'
}
}
}
}
else {
else {
...
@@ -964,50 +964,50 @@ class DolGraph
...
@@ -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
.
=
'function plotWithOptions_'
.
$tag
.
'() {'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'$.plot($("#placeholder_'
.
$tag
.
'"), [ '
.
"
\n
"
;
$this
->
stringtoshow
.
=
'$.plot($("#placeholder_'
.
$tag
.
'"), [ '
.
"
\n
"
;
$i
=
$firstlot
;
$i
=
$firstlot
;
while
(
$i
<
$nblot
)
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
]);
$color
=
sprintf
(
"%02x%02x%02x"
,
$this
->
datacolor
[
$i
][
0
],
$this
->
datacolor
[
$i
][
1
],
$this
->
datacolor
[
$i
][
2
]);
$this
->
_
stringtoshow
.
=
'{ '
;
$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
]
==
'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 }, '
;
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
.
=
'color: "#'
.
$color
.
'", label: "'
.
(
isset
(
$this
->
Legend
[
$i
])
?
dol_escape_js
(
$this
->
Legend
[
$i
])
:
''
)
.
'", data: d'
.
$i
.
' }'
;
$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
// Xaxis
$this
->
_
stringtoshow
.
=
', xaxis: { ticks: ['
.
"
\n
"
;
$this
->
stringtoshow
.
=
', xaxis: { ticks: ['
.
"
\n
"
;
$x
=
0
;
$x
=
0
;
foreach
(
$this
->
data
as
$key
=>
$valarray
)
foreach
(
$this
->
data
as
$key
=>
$valarray
)
{
{
if
(
$x
>
0
)
$this
->
_
stringtoshow
.
=
', '
.
"
\n
"
;
if
(
$x
>
0
)
$this
->
stringtoshow
.
=
', '
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
' ['
.
$x
.
', "'
.
$valarray
[
0
]
.
'"]'
;
$this
->
stringtoshow
.
=
' ['
.
$x
.
', "'
.
$valarray
[
0
]
.
'"]'
;
$x
++
;
$x
++
;
}
}
$this
->
_
stringtoshow
.
=
'] }'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'] }'
.
"
\n
"
;
// Yaxis
// Yaxis
$this
->
_
stringtoshow
.
=
', yaxis: { min: '
.
$this
->
MinValue
.
', max: '
.
(
$this
->
MaxValue
)
.
' }'
.
"
\n
"
;
$this
->
stringtoshow
.
=
', yaxis: { min: '
.
$this
->
MinValue
.
', max: '
.
(
$this
->
MaxValue
)
.
' }'
.
"
\n
"
;
// Background color
// Background color
$color1
=
sprintf
(
"%02x%02x%02x"
,
$this
->
bgcolorgrid
[
0
],
$this
->
bgcolorgrid
[
0
],
$this
->
bgcolorgrid
[
2
]);
$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
]);
$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
.
=
', grid: { hoverable: true, backgroundColor: { colors: ["#'
.
$color1
.
'", "#'
.
$color2
.
'"] } }'
.
"
\n
"
;
//$this->
_
stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
//$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this
->
_
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'}'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'}'
.
"
\n
"
;
}
}
$this
->
_
stringtoshow
.
=
'plotWithOptions_'
.
$tag
.
'();'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'plotWithOptions_'
.
$tag
.
'();'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'});'
.
"
\n
"
;
$this
->
_
stringtoshow
.
=
'</script>'
.
"
\n
"
;
$this
->
stringtoshow
.
=
'</script>'
.
"
\n
"
;
}
}
...
@@ -1019,7 +1019,7 @@ class DolGraph
...
@@ -1019,7 +1019,7 @@ class DolGraph
*/
*/
function
show
()
function
show
()
{
{
return
$this
->
_
stringtoshow
;
return
$this
->
stringtoshow
;
}
}
...
...
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