Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <script src="js/sigma.min.js"></script>
- </head>
- <body>
- <div class="container">
- <div class="row">
- <h2 >This is the result ! </h2>
- I used data I gathered a few months ago (it shows how one of my picture was shared on social networks)
- <div class="sigma-parent" id="sigma-example-parent">
- <div class="sigma-expand" id="sigma-example"></div>
- </div>
- </div>
- <script src="js/sigma.parseGexf.js"></script><script type="text/javascript">function init() {
- // Instanciate sigma.js and customize rendering :
- var sigInst = sigma.init(document.getElementById('sigma-example')).drawingProperties({
- defaultLabelColor: '#fff',
- defaultLabelSize: 14,
- defaultLabelBGColor: '#fff',
- defaultLabelHoverColor: '#000',
- labelThreshold: 6,
- defaultEdgeType: 'curve'
- }).graphProperties({
- minNodeSize: 1,
- maxNodeSize: 10,
- minEdgeSize: 1,
- maxEdgeSize: 1
- }).mouseProperties({
- maxRatio: 32
- });
- // Parse a GEXF encoded file to fill the graph
- // (requires "sigma.parseGexf.js" to be included)
- sigInst.parseGexf('data/essai.gexf');
- //highlights the nodes that is hovered+ its edges
- //
- // Bind events :
- var greyColor = '#666';
- sigInst.bind('overnodes',function(event){
- var nodes = event.content;
- var neighbors = {};
- sigInst.iterEdges(function(e){
- if(nodes.indexOf(e.source)<0 && nodes.indexOf(e.target)<0){
- if(!e.attr['grey']){
- e.attr['true_color'] = e.color;
- e.color = greyColor;
- e.attr['grey'] = 1;
- }
- }else{
- e.color = e.attr['grey'] ? e.attr['true_color'] : e.color;
- e.attr['grey'] = 0;
- neighbors[e.source] = 1;
- neighbors[e.target] = 1;
- }
- }).iterNodes(function(n){
- if(!neighbors[n.id]){
- if(!n.attr['grey']){
- n.attr['true_color'] = n.color;
- n.color = greyColor;
- n.attr['grey'] = 1;
- }
- }else{
- n.color = n.attr['grey'] ? n.attr['true_color'] : n.color;
- n.attr['grey'] = 0;
- }
- }).draw(2,2,2);
- }).bind('outnodes',function(){
- sigInst.iterEdges(function(e){
- e.color = e.attr['grey'] ? e.attr['true_color'] : e.color;
- e.attr['grey'] = 0;
- }).iterNodes(function(n){
- n.color = n.attr['grey'] ? n.attr['true_color'] : n.color;
- n.attr['grey'] = 0;
- }).draw(2,2,2);
- });
- // Draw the graph :
- sigInst.draw();
- }
- if (document.addEventListener) {
- document.addEventListener("DOMContentLoaded", init, false);
- } else {
- window.onload = init;
- }
- </script>
- <style type="text/css">
- /* sigma.js context : */
- .sigma-parent {
- position: relative;
- border-radius: 4px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- background: #222;
- height: 1000px;
- }
- .sigma-expand {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- }
- .buttons-container{
- padding-bottom: 8px;
- padding-top: 12px;
- }
- </style>
- <?php include("../php/statcounter.php"); ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement