Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Imène Lajili
clowdflows
Commits
d0746d3a
Commit
d0746d3a
authored
Feb 07, 2013
by
Anze Vavpetic
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of workflow.ijs.si:mothra into dev
parents
1f9f7c1a
afdcfb68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
20 deletions
+18
-20
workflows/templates/visualizations/tree_visualization.html
workflows/templates/visualizations/tree_visualization.html
+7
-15
workflows/visualization_views.py
workflows/visualization_views.py
+11
-5
No files found.
workflows/templates/visualizations/tree_visualization.html
View file @
d0746d3a
...
...
@@ -17,7 +17,7 @@
}
</style>
<div
id=
"widgetvisualization-{{widget.pk}}"
rel=
"{{widget.pk}}"
width=
"900"
height=
"
60
0"
class=
"widgetvisualizationdialog"
title=
"{{widget.name}}"
>
<div
id=
"widgetvisualization-{{widget.pk}}"
rel=
"{{widget.pk}}"
width=
"900"
height=
"
75
0"
class=
"widgetvisualizationdialog"
title=
"{{widget.name}}"
>
...
...
@@ -28,9 +28,9 @@
src
=
"
https://raw.github.com/mbostock/d3/master/d3.js
"
var
m
=
[
20
,
80
,
20
,
12
0
],
var
m
=
[
20
,
250
,
20
,
4
0
],
w
=
870
-
m
[
1
]
-
m
[
3
],
h
=
50
0
-
m
[
0
]
-
m
[
2
],
h
=
66
0
-
m
[
0
]
-
m
[
2
],
i
=
0
,
json
;
...
...
@@ -64,11 +64,6 @@ function(json) {
// Initialize the display to show a few nodes.
json
.
children
.
forEach
(
toggleAll
);
// toggle(json.children[1]);
//toggle(json.children[1].children[2]);
//toggle(json.children[9]);
//toggle(json.children[9].children[0]);
update
(
json
);
// echo json;
...
...
@@ -80,7 +75,7 @@ function update(source) {
var
nodes
=
tree
.
nodes
(
json
).
reverse
();
// Normalize for fixed-depth.
nodes
.
forEach
(
function
(
d
)
{
d
.
y
=
d
.
depth
*
100
;
});
//
nodes.forEach(function(d) { d.y = d.depth * 100; });
// Update the nodes…
var
node
=
vis
.
selectAll
(
"
g.node
"
)
...
...
@@ -97,9 +92,9 @@ function update(source) {
.
style
(
"
fill
"
,
function
(
d
)
{
return
d
.
_children
?
"
#F7B64C
"
:
"
#F2D5A8
"
;
});
nodeEnter
.
append
(
"
svg:text
"
)
.
attr
(
"
x
"
,
function
(
d
)
{
return
d
.
children
||
d
.
_children
?
-
10
:
10
;
})
.
attr
(
"
x
"
,
function
(
d
)
{
return
d
.
children
||
d
.
_children
?
10
:
10
;
})
.
attr
(
"
dy
"
,
"
.35em
"
)
.
attr
(
"
text-anchor
"
,
function
(
d
)
{
return
d
.
children
||
d
.
_children
?
"
end
"
:
"
start
"
;
}
)
.
attr
(
"
text-anchor
"
,
"
start
"
)
.
text
(
function
(
d
)
{
return
d
.
name
;
})
.
style
(
"
fill-opacity
"
,
1
e
-
6
);
...
...
@@ -177,9 +172,6 @@ function toggle(d) {
}
}
</script>
{{json}}
</script>
</div>
\ No newline at end of file
workflows/visualization_views.py
View file @
d0746d3a
...
...
@@ -203,7 +203,8 @@ def treeToJSON(node, path="", nodes={}):
if
path
==
""
:
#get the dictionary prepared, insert root node
nodes
.
update
({
#root node properties
"name"
:
node
.
branch_selector
.
class_var
.
name
,
"name"
:
"root"
,
# "name":node.node_classifier.class_var.name,
"ID"
:
node
.
reference
(),
"children"
:[]
})
...
...
@@ -214,7 +215,8 @@ def treeToJSON(node, path="", nodes={}):
try
:
if
node
.
branches
[
n
].
branch_selector
:
#if the node (branch) has branches
child
=
{
#set node properties
"name"
:
node
.
branch_descriptions
[
n
]
+
" - "
+
node
.
branches
[
n
].
branch_selector
.
class_var
.
name
,
"name"
:
node
.
branch_selector
.
class_var
.
name
[:
15
]
+
" "
+
node
.
branch_descriptions
[
n
][:
10
],
"ID"
:
node
.
branches
[
n
].
reference
(),
"children"
:[]
#stays open for future descendant nodes
}
...
...
@@ -226,7 +228,13 @@ def treeToJSON(node, path="", nodes={}):
else
:
#if node is a leaf
child
=
{
"name"
:
node
.
branch_descriptions
[
n
]
+
" - "
+
node
.
branches
[
n
].
node_classifier
.
default_value
.
value
,
"name"
:
node
.
branch_selector
.
class_var
.
name
+
" "
+
node
.
branch_descriptions
[
n
]
+
": "
+
node
.
branches
[
n
].
node_classifier
.
default_value
.
value
+
" ("
+
str
(
node
.
branches
[
n
].
node_classifier
.
GetProbabilities
*
100
)
+
"%)"
,
"ID"
:
node
.
branches
[
n
].
reference
(),
}
eval
(
"nodes"
+
path
+
".append("
+
str
(
child
)
+
")"
)
...
...
@@ -246,7 +254,5 @@ def tree_visualization(request, input_dict, output_dict, widget):
tc
=
input_dict
[
'clt'
]
jsonJ
=
treeToJSON
(
tc
.
tree
)
print
jsonJ
return
render
(
request
,
'visualizations/tree_visualization.html'
,
{
'widget'
:
widget
,
'input_dict'
:
input_dict
,
'json'
:
jsonJ
})
\ No newline at end of file
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