Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Stack Of Tasks
dynamic-graph
Commits
1ef860a0
Commit
1ef860a0
authored
5 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
[js/doc] Add display using a browser and documentation
parent
483a2b9b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/additionalDoc/writeGraph.h
+4
-0
4 additions, 0 deletions
doc/additionalDoc/writeGraph.h
js/view_sot_dg.html
+52
-0
52 additions, 0 deletions
js/view_sot_dg.html
with
56 additions
and
0 deletions
doc/additionalDoc/writeGraph.h
+
4
−
0
View file @
1ef860a0
...
...
@@ -19,4 +19,8 @@ dot -Tpdf /tmp/my_dynamic_graph.dot > /tmp/my_dynamic_graph.pdf
It provides the following output:
\image html my_dynamic_graph.png
\section fromdottojs Viewing in a browser
To view the dot file you can simply use the view_sot_dg.html file.
Click on the "Choose File" to specify the filem and click on "Rendering" to display the graph.
*/
This diff is collapsed.
Click to expand it.
js/view_sot_dg.html
0 → 100644
+
52
−
0
View file @
1ef860a0
<html>
<body>
<script
src=
"https://github.com/mdaines/viz.js/releases/download/v2.1.2/viz.js"
></script>
<script
src=
"https://github.com/mdaines/viz.js/releases/download/v2.1.2/full.render.js"
></script>
<script>
function
renderDOTFile
()
{
var
fileInputElement
=
document
.
getElementById
(
"
fileInputElement
"
);
var
reader
=
new
FileReader
();
var
graphtextres
=
""
reader
.
onloadend
=
function
(
e
)
{
graphtextres
=
e
.
target
.
result
var
viz
=
new
Viz
();
viz
.
renderSVGElement
(
graphtextres
)
.
then
(
function
(
element
)
{
elementToRemove
=
document
.
getElementById
(
"
displaysvgzone
"
)
if
(
elementToRemove
!=
null
)
{
document
.
body
.
removeChild
(
elementToRemove
)
}
document
.
body
.
appendChild
(
element
)
element
.
id
=
"
displaysvgzone
"
})
.
catch
(
error
=>
{
// Create a new Viz instance (@see Caveats page for more info)
viz
=
new
Viz
();
// Possibly display the error
console
.
error
(
error
);
});
}
reader
.
readAsText
(
fileInputElement
.
files
[
0
]);
};
</script>
<input
type=
"file"
id=
"fileInputElement"
>
<input
id=
"Rendering"
type=
"button"
value=
"Rendering"
onclick=
"renderDOTFile();"
/>
<script>
var
el
=
document
.
getElementById
(
"
Rendering
"
);
if
(
el
.
addEventListener
)
el
.
addEventListener
(
"
click
"
,
renderDOTFile
,
false
);
else
if
(
el
.
attachEvent
)
el
.
attachEvent
(
'
onclick
'
,
renderDOTFile
);
</script>
</body>
</html>
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