Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
apachedex
Commits
28c6d5c3
Commit
28c6d5c3
authored
Jan 24, 2020
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apachedex: render plotly graph only when displayed, this avoid rendering hidden graphs
parent
f7452cce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
25 deletions
+9
-25
apachedex/__init__.py
apachedex/__init__.py
+7
-11
apachedex/apachedex.js
apachedex/apachedex.js
+2
-14
No files found.
apachedex/__init__.py
View file @
28c6d5c3
...
@@ -272,17 +272,13 @@ def graph(title, data, options={}, height=300):
...
@@ -272,17 +272,13 @@ def graph(title, data, options={}, height=300):
count_graph
+=
1
count_graph
+=
1
div_id
=
"graph_%i"
%
count_graph
div_id
=
"graph_%i"
%
count_graph
append
=
result
.
append
append
=
result
.
append
append
(
'<h2>%s</h2><div id="%s" '
append
(
'<h2>%s</h2><div id="%s" class="graph" '
'style="width:600px;height:%ipx"></div>'
%
(
title
,
div_id
,
height
))
'style="width:600px;height:%ipx" '
%
(
title
,
div_id
,
height
))
append
(
'</script><script type="text/javascript">//<![CDATA['
)
append
(
' data-points="'
)
append
(
"""
append
(
escape
(
json
.
dumps
(
data
),
quote
=
True
))
TESTER = document.getElementById('%s');
append
(
'" data-options="'
)
Plotly.plot( TESTER,"""
%
div_id
)
append
(
escape
(
json
.
dumps
(
options
),
quote
=
True
))
append
(
json
.
dumps
(
data
))
append
(
'"></div>"'
)
append
(
','
)
append
(
json
.
dumps
(
options
))
append
(
',{modeBarButtonsToRemove: ["sendDataToCloud"]});'
)
append
(
'//]]></script>'
)
return
''
.
join
(
result
)
return
''
.
join
(
result
)
class
APDEXStats
(
object
):
class
APDEXStats
(
object
):
...
...
apachedex/apachedex.js
View file @
28c6d5c3
...
@@ -49,21 +49,9 @@ function updateAxisTransform(axis) {
...
@@ -49,21 +49,9 @@ function updateAxisTransform(axis) {
function
renderGraph
(
container
)
{
function
renderGraph
(
container
)
{
var
container
=
$
(
container
);
var
container
=
$
(
container
);
var
previousIndex
=
null
;
var
previousIndex
=
null
;
var
tooltip
=
container
.
next
(
"
.tooltip
"
);
var
options
=
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
));
var
options
=
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
));
updateAxisTransform
(
options
.
xaxis
);
var
data
=
$
.
parseJSON
(
container
.
attr
(
"
data-points
"
));
updateAxisTransform
(
options
.
yaxis
);
Plotly
.
plot
(
container
[
0
],
data
,
options
,
{
modeBarButtonsToRemove
:
[
"
sendDataToCloud
"
]});
var
plot
=
$
.
plot
(
container
,
$
.
parseJSON
(
container
.
attr
(
"
data-points
"
)),
options
);
tooltip
.
detach
();
container
.
append
(
tooltip
);
container
.
bind
(
"
plothover
"
,
function
(
event
,
pos
,
item
)
{
previousIndex
=
updateGraphTooltip
(
event
,
pos
,
item
,
previousIndex
,
tooltip
,
plot
);
});
}
}
function
toggleGraph
(
node
)
{
function
toggleGraph
(
node
)
{
var
container
=
$
(
node
).
parent
().
find
(
"
.container
"
);
var
container
=
$
(
node
).
parent
().
find
(
"
.container
"
);
...
...
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