| @ -0,0 +1,235 @@ | |||
| .vis.timeline { | |||
| } | |||
| .vis.timeline.rootpanel { | |||
| position: relative; | |||
| overflow: hidden; | |||
| border: 1px solid #bfbfbf; | |||
| -moz-box-sizing: border-box; | |||
| box-sizing: border-box; | |||
| } | |||
| .vis.timeline .panel { | |||
| position: absolute; | |||
| overflow: hidden; | |||
| } | |||
| .vis.timeline .groupset { | |||
| position: absolute; | |||
| padding: 0; | |||
| margin: 0; | |||
| } | |||
| .vis.timeline .labels { | |||
| position: absolute; | |||
| top: 0; | |||
| left: 0; | |||
| width: 100%; | |||
| height: 100%; | |||
| padding: 0; | |||
| margin: 0; | |||
| border-right: 1px solid #bfbfbf; | |||
| box-sizing: border-box; | |||
| -moz-box-sizing: border-box; | |||
| } | |||
| .vis.timeline .labels .label-set { | |||
| position: absolute; | |||
| top: 0; | |||
| left: 0; | |||
| width: 100%; | |||
| height: 100%; | |||
| overflow: hidden; | |||
| border-top: none; | |||
| border-bottom: 1px solid #bfbfbf; | |||
| } | |||
| .vis.timeline .labels .label-set .label { | |||
| position: absolute; | |||
| left: 0; | |||
| top: 0; | |||
| width: 100%; | |||
| color: #4d4d4d; | |||
| } | |||
| .vis.timeline.top .labels .label-set .label, | |||
| .vis.timeline.top .groupset .itemset-axis { | |||
| border-top: 1px solid #bfbfbf; | |||
| border-bottom: none; | |||
| } | |||
| .vis.timeline.bottom .labels .label-set .label, | |||
| .vis.timeline.bottom .groupset .itemset-axis { | |||
| border-top: none; | |||
| border-bottom: 1px solid #bfbfbf; | |||
| } | |||
| .vis.timeline .labels .label-set .label .inner { | |||
| display: inline-block; | |||
| padding: 5px; | |||
| } | |||
| .vis.timeline .itemset { | |||
| position: absolute; | |||
| padding: 0; | |||
| margin: 0; | |||
| overflow: hidden; | |||
| } | |||
| .vis.timeline .background { | |||
| } | |||
| .vis.timeline .foreground { | |||
| } | |||
| .vis.timeline .itemset-axis { | |||
| position: absolute; | |||
| } | |||
| .vis.timeline .item { | |||
| position: absolute; | |||
| color: #1A1A1A; | |||
| border-color: #97B0F8; | |||
| background-color: #D5DDF6; | |||
| display: inline-block; | |||
| } | |||
| .vis.timeline .item.selected { | |||
| border-color: #FFC200; | |||
| background-color: #FFF785; | |||
| z-index: 999; | |||
| } | |||
| .vis.timeline .item.cluster { | |||
| /* TODO: use another color or pattern? */ | |||
| background: #97B0F8 url('img/cluster_bg.png'); | |||
| color: white; | |||
| } | |||
| .vis.timeline .item.cluster.point { | |||
| border-color: #D5DDF6; | |||
| } | |||
| .vis.timeline .item.box { | |||
| text-align: center; | |||
| border-style: solid; | |||
| border-width: 1px; | |||
| border-radius: 5px; | |||
| -moz-border-radius: 5px; /* For Firefox 3.6 and older */ | |||
| } | |||
| .vis.timeline .item.point { | |||
| background: none; | |||
| } | |||
| .vis.timeline .dot { | |||
| border: 5px solid #97B0F8; | |||
| position: absolute; | |||
| border-radius: 5px; | |||
| -moz-border-radius: 5px; /* For Firefox 3.6 and older */ | |||
| } | |||
| .vis.timeline .item.range { | |||
| overflow: hidden; | |||
| border-style: solid; | |||
| border-width: 1px; | |||
| border-radius: 2px; | |||
| -moz-border-radius: 2px; /* For Firefox 3.6 and older */ | |||
| } | |||
| .vis.timeline .item.rangeoverflow { | |||
| border-style: solid; | |||
| border-width: 1px; | |||
| border-radius: 2px; | |||
| -moz-border-radius: 2px; /* For Firefox 3.6 and older */ | |||
| } | |||
| .vis.timeline .item.range .drag-left, .vis.timeline .item.rangeoverflow .drag-left { | |||
| cursor: w-resize; | |||
| z-index: 1000; | |||
| } | |||
| .vis.timeline .item.range .drag-right, .vis.timeline .item.rangeoverflow .drag-right { | |||
| cursor: e-resize; | |||
| z-index: 1000; | |||
| } | |||
| .vis.timeline .item.range .content, .vis.timeline .item.rangeoverflow .content { | |||
| position: relative; | |||
| display: inline-block; | |||
| } | |||
| .vis.timeline .item.line { | |||
| position: absolute; | |||
| width: 0; | |||
| border-left-width: 1px; | |||
| border-left-style: solid; | |||
| } | |||
| .vis.timeline .item .content { | |||
| margin: 5px; | |||
| white-space: nowrap; | |||
| overflow: hidden; | |||
| } | |||
| .vis.timeline .axis { | |||
| position: relative; | |||
| } | |||
| .vis.timeline .axis .text { | |||
| position: absolute; | |||
| color: #4d4d4d; | |||
| padding: 3px; | |||
| white-space: nowrap; | |||
| } | |||
| .vis.timeline .axis .text.measure { | |||
| position: absolute; | |||
| padding-left: 0; | |||
| padding-right: 0; | |||
| margin-left: 0; | |||
| margin-right: 0; | |||
| visibility: hidden; | |||
| } | |||
| .vis.timeline .axis .grid.vertical { | |||
| position: absolute; | |||
| width: 0; | |||
| border-right: 1px solid; | |||
| } | |||
| .vis.timeline .axis .grid.horizontal { | |||
| position: absolute; | |||
| left: 0; | |||
| width: 100%; | |||
| height: 0; | |||
| border-bottom: 1px solid; | |||
| } | |||
| .vis.timeline .axis .grid.minor { | |||
| border-color: #e5e5e5; | |||
| } | |||
| .vis.timeline .axis .grid.major { | |||
| border-color: #bfbfbf; | |||
| } | |||
| .vis.timeline .currenttime { | |||
| background-color: #FF7F6E; | |||
| width: 2px; | |||
| z-index: 9; | |||
| } | |||
| .vis.timeline .customtime { | |||
| background-color: #6E94FF; | |||
| width: 2px; | |||
| cursor: move; | |||
| z-index: 9; | |||
| } | |||
| @ -1,87 +1,87 @@ | |||
| .com { | |||
| color: gray; | |||
| color: gray; | |||
| } | |||
| .lit { | |||
| color: red; | |||
| color: red; | |||
| } | |||
| .pun { | |||
| color: gray; | |||
| color: gray; | |||
| } | |||
| .pln { | |||
| color: #333333; | |||
| color: #333333; | |||
| } | |||
| pre.prettyprint { | |||
| border: 1px solid lightgray; | |||
| background-color: #fcfcfc; | |||
| padding: 5px; | |||
| border: 1px solid lightgray; | |||
| background-color: #fcfcfc; | |||
| padding: 5px; | |||
| font-size: 10pt; | |||
| line-height: 1.5em; | |||
| font-family: monospace; | |||
| font-size: 10pt; | |||
| line-height: 1.5em; | |||
| font-family: monospace; | |||
| } | |||
| ol.linenums { | |||
| margin-top:0; | |||
| margin-bottom:0; | |||
| margin-top:0; | |||
| margin-bottom:0; | |||
| } | |||
| li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { | |||
| list-style:none; | |||
| list-style:none; | |||
| } | |||
| li.L1,li.L3,li.L5,li.L7,li.L9 { | |||
| background:#eee; | |||
| background:#eee; | |||
| } | |||
| .str,.atv { | |||
| color: green; | |||
| color: green; | |||
| } | |||
| .kwd,.tag { | |||
| color:#2B7CE9; | |||
| color:#2B7CE9; | |||
| } | |||
| .typ,.atn,.dec { | |||
| color: darkorange; | |||
| color: darkorange; | |||
| } | |||
| @media print { | |||
| .com { | |||
| color:#600; | |||
| font-style:italic; | |||
| } | |||
| .typ { | |||
| color:#404; | |||
| font-weight:700; | |||
| } | |||
| .lit { | |||
| color:#044; | |||
| } | |||
| .pun { | |||
| color:#440; | |||
| } | |||
| .pln { | |||
| color:#000; | |||
| } | |||
| .atn { | |||
| color:#404; | |||
| } | |||
| .str,.atv { | |||
| color:#060; | |||
| } | |||
| .kwd,.tag { | |||
| color:#006; | |||
| font-weight:700; | |||
| } | |||
| .com { | |||
| color:#600; | |||
| font-style:italic; | |||
| } | |||
| .typ { | |||
| color:#404; | |||
| font-weight:700; | |||
| } | |||
| .lit { | |||
| color:#044; | |||
| } | |||
| .pun { | |||
| color:#440; | |||
| } | |||
| .pln { | |||
| color:#000; | |||
| } | |||
| .atn { | |||
| color:#404; | |||
| } | |||
| .str,.atv { | |||
| color:#060; | |||
| } | |||
| .kwd,.tag { | |||
| color:#006; | |||
| font-weight:700; | |||
| } | |||
| } | |||
| @ -1,77 +1,77 @@ | |||
| html, body { | |||
| width: 100%; | |||
| height: 100%; | |||
| padding: 0; | |||
| margin: 0; | |||
| width: 100%; | |||
| height: 100%; | |||
| padding: 0; | |||
| margin: 0; | |||
| } | |||
| body, td, th { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| color: #4D4D4D; | |||
| line-height: 1.7em; | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| color: #4D4D4D; | |||
| line-height: 1.7em; | |||
| } | |||
| #container { | |||
| position: relative; | |||
| margin: 0 auto; | |||
| padding: 10px 10px 50px 10px; | |||
| width: 700px; | |||
| max-width: 100%; | |||
| box-sizing: border-box; | |||
| position: relative; | |||
| margin: 0 auto; | |||
| padding: 10px 10px 50px 10px; | |||
| width: 700px; | |||
| max-width: 100%; | |||
| box-sizing: border-box; | |||
| } | |||
| h1 { | |||
| font-size: 180%; | |||
| font-weight: bold; | |||
| padding: 0; | |||
| margin: 1em 0 1em 0; | |||
| font-size: 180%; | |||
| font-weight: bold; | |||
| padding: 0; | |||
| margin: 1em 0 1em 0; | |||
| } | |||
| h2 { | |||
| padding-top: 20px; | |||
| padding-bottom: 10px; | |||
| border-bottom: 1px solid #a0c0f0; | |||
| color: #2B7CE9; | |||
| padding-top: 20px; | |||
| padding-bottom: 10px; | |||
| border-bottom: 1px solid #a0c0f0; | |||
| color: #2B7CE9; | |||
| } | |||
| h3 { | |||
| font-size: 140%; | |||
| font-size: 140%; | |||
| } | |||
| a > img { | |||
| border: none; | |||
| border: none; | |||
| } | |||
| a { | |||
| color: #2B7CE9; | |||
| text-decoration: none; | |||
| color: #2B7CE9; | |||
| text-decoration: none; | |||
| } | |||
| a:visited { | |||
| color: #2E60A4; | |||
| color: #2E60A4; | |||
| } | |||
| a:hover { | |||
| color: red; | |||
| text-decoration: underline; | |||
| color: red; | |||
| text-decoration: underline; | |||
| } | |||
| table { | |||
| border-collapse: collapse; | |||
| border-collapse: collapse; | |||
| } | |||
| th { | |||
| font-weight: bold; | |||
| border: 1px solid lightgray; | |||
| background-color: #E5E5E5; | |||
| text-align: left; | |||
| vertical-align: top; | |||
| padding: 5px; | |||
| font-weight: bold; | |||
| border: 1px solid lightgray; | |||
| background-color: #E5E5E5; | |||
| text-align: left; | |||
| vertical-align: top; | |||
| padding: 5px; | |||
| } | |||
| td { | |||
| border: 1px solid lightgray; | |||
| padding: 5px; | |||
| vertical-align: top; | |||
| border: 1px solid lightgray; | |||
| padding: 5px; | |||
| vertical-align: top; | |||
| } | |||
| @ -1,65 +1,65 @@ | |||
| <!doctype html> | |||
| <html> | |||
| <head> | |||
| <title>Graph | Dashed lines</title> | |||
| <title>Graph | Dashed lines</title> | |||
| <style type="text/css"> | |||
| body { | |||
| font: 10pt sans; | |||
| } | |||
| #mygraph { | |||
| width: 600px; | |||
| height: 600px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| <style type="text/css"> | |||
| body { | |||
| font: 10pt sans; | |||
| } | |||
| #mygraph { | |||
| width: 600px; | |||
| height: 600px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| <script type="text/javascript" src="../../vis.js"></script> | |||
| <script type="text/javascript" src="../../dist/vis.js"></script> | |||
| <script type="text/javascript"> | |||
| // Called on page load | |||
| function draw() { | |||
| var nodes = [ | |||
| {id: 1, label: 'dashed\nline\nexamples'}, | |||
| {id: 2, label: 'default'}, | |||
| {id: 3, label: 'dash.length: 20\ndash.gap: 20'}, | |||
| {id: 4, label: 'dash.length: 20\ndash.gap: 5'}, | |||
| {id: 5, label: 'dash.length: 5\ndash.gap: 20'}, | |||
| {id: 6, label: 'dash.length: 20\ndash.gap: 5\ndash.altLength: 5'} | |||
| ]; | |||
| var edges = [ | |||
| {from: 1, to: 2, style: 'dash-line'}, | |||
| {from: 1, to: 3, style: 'dash-line', dash: {length: 20, gap: 20}}, | |||
| {from: 1, to: 4, style: 'dash-line', dash: {length: 20, gap: 5}}, | |||
| {from: 1, to: 5, style: 'dash-line', dash: {length: 5, gap: 20}}, | |||
| {from: 1, to: 6, style: 'dash-line', dash: {length: 20, gap: 5, altLength: 5}} | |||
| ]; | |||
| <script type="text/javascript"> | |||
| // Called on page load | |||
| function draw() { | |||
| var nodes = [ | |||
| {id: 1, label: 'dashed\nline\nexamples'}, | |||
| {id: 2, label: 'default'}, | |||
| {id: 3, label: 'dash.length: 20\ndash.gap: 20'}, | |||
| {id: 4, label: 'dash.length: 20\ndash.gap: 5'}, | |||
| {id: 5, label: 'dash.length: 5\ndash.gap: 20'}, | |||
| {id: 6, label: 'dash.length: 20\ndash.gap: 5\ndash.altLength: 5'} | |||
| ]; | |||
| var edges = [ | |||
| {from: 1, to: 2, style: 'dash-line'}, | |||
| {from: 1, to: 3, style: 'dash-line', dash: {length: 20, gap: 20}}, | |||
| {from: 1, to: 4, style: 'dash-line', dash: {length: 20, gap: 5}}, | |||
| {from: 1, to: 5, style: 'dash-line', dash: {length: 5, gap: 20}}, | |||
| {from: 1, to: 6, style: 'dash-line', dash: {length: 20, gap: 5, altLength: 5}} | |||
| ]; | |||
| // create the graph | |||
| var container = document.getElementById('mygraph'); | |||
| var data = { | |||
| nodes: nodes, | |||
| edges: edges | |||
| }; | |||
| var options = { | |||
| nodes: { | |||
| shape: 'box' | |||
| }, | |||
| edges: { | |||
| length: 180 | |||
| }, | |||
| stabilize: false | |||
| }; | |||
| var graph = new vis.Graph(container, data, options); | |||
| } | |||
| </script> | |||
| // create the graph | |||
| var container = document.getElementById('mygraph'); | |||
| var data = { | |||
| nodes: nodes, | |||
| edges: edges | |||
| }; | |||
| var options = { | |||
| nodes: { | |||
| shape: 'box' | |||
| }, | |||
| edges: { | |||
| length: 180 | |||
| }, | |||
| stabilize: false | |||
| }; | |||
| var graph = new vis.Graph(container, data, options); | |||
| } | |||
| </script> | |||
| </head> | |||
| <body onload="draw();"> | |||
| <p> | |||
| This example shows the different options for dashed lines. | |||
| </p> | |||
| <p> | |||
| This example shows the different options for dashed lines. | |||
| </p> | |||
| <div id="mygraph"></div> | |||
| <div id="mygraph"></div> | |||
| </body> | |||
| </html> | |||
| @ -1,18 +1,18 @@ | |||
| <html> | |||
| <head> | |||
| <title>Graph | DOT Language</title> | |||
| <title>Graph | DOT Language</title> | |||
| <script type="text/javascript" src="../../vis.js"></script> | |||
| <script type="text/javascript" src="../../dist/vis.js"></script> | |||
| </head> | |||
| <body> | |||
| <div id="mygraph"></div> | |||
| <div id="mygraph"></div> | |||
| <script type="text/javascript"> | |||
| var container = document.getElementById('mygraph'); | |||
| var data = { | |||
| dot: 'digraph {node[shape=circle]; 1 -> 1 -> 2; 2 -> 3; 2 -- 4; 2 -> 1 }' | |||
| }; | |||
| var graph = new vis.Graph(container, data); | |||
| </script> | |||
| <script type="text/javascript"> | |||
| var container = document.getElementById('mygraph'); | |||
| var data = { | |||
| dot: 'digraph {node[shape=circle]; 1 -> 1 -> 2; 2 -> 3; 2 -- 4; 2 -> 1 }' | |||
| }; | |||
| var graph = new vis.Graph(container, data); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @ -1,201 +1,201 @@ | |||
| <!doctype html> | |||
| <html> | |||
| <head> | |||
| <title>Graph | DOT language playground</title> | |||
| <script type="text/javascript" src="../../vis.js"></script> | |||
| <style type="text/css"> | |||
| body, html { | |||
| font: 10pt sans; | |||
| width: 100%; | |||
| height: 100%; | |||
| padding: 0; | |||
| margin: 0; | |||
| color: #4d4d4d; | |||
| } | |||
| <title>Graph | DOT language playground</title> | |||
| <script type="text/javascript" src="../../dist/vis.js"></script> | |||
| <style type="text/css"> | |||
| body, html { | |||
| font: 10pt sans; | |||
| width: 100%; | |||
| height: 100%; | |||
| padding: 0; | |||
| margin: 0; | |||
| color: #4d4d4d; | |||
| } | |||
| #frame { | |||
| width: 100%; | |||
| height: 99%; | |||
| } | |||
| #frame td { | |||
| padding: 10px; | |||
| height: 100%; | |||
| } | |||
| #error { | |||
| color: red; | |||
| } | |||
| #frame { | |||
| width: 100%; | |||
| height: 99%; | |||
| } | |||
| #frame td { | |||
| padding: 10px; | |||
| height: 100%; | |||
| } | |||
| #error { | |||
| color: red; | |||
| } | |||
| #data { | |||
| width: 100%; | |||
| height: 100%; | |||
| border: 1px solid #d3d3d3; | |||
| } | |||
| #data { | |||
| width: 100%; | |||
| height: 100%; | |||
| border: 1px solid #d3d3d3; | |||
| } | |||
| #mygraph { | |||
| float: left; | |||
| width: 100%; | |||
| height: 100%; | |||
| border: 1px solid #d3d3d3; | |||
| box-sizing: border-box; | |||
| -moz-box-sizing: border-box; | |||
| overflow: hidden; | |||
| } | |||
| #mygraph { | |||
| float: left; | |||
| width: 100%; | |||
| height: 100%; | |||
| border: 1px solid #d3d3d3; | |||
| box-sizing: border-box; | |||
| -moz-box-sizing: border-box; | |||
| overflow: hidden; | |||
| } | |||
| textarea.example { | |||
| display: none; | |||
| } | |||
| </style> | |||
| textarea.example { | |||
| display: none; | |||
| } | |||
| </style> | |||
| </head> | |||
| <body onload="drawExample('example1')"> | |||
| <table id="frame"> | |||
| <col width="50%"> | |||
| <col width="50%"> | |||
| <tr> | |||
| <td colspan="2" style="height: 50px;"> | |||
| <h1>DOT language playground</h1> | |||
| <div> | |||
| <a href="javascript: drawExample('example1')">example 1</a> | |||
| <a href="javascript: drawExample('example2')">example 2</a> | |||
| <a href="javascript: drawExample('example3')">example 3</a> | |||
| </div> | |||
| <div> | |||
| <br> | |||
| <button id="draw">Draw</button> | |||
| <span id="error"></span> | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td> | |||
| <textarea id="data"></textarea> | |||
| </td> | |||
| <td> | |||
| <div id="mygraph"></div> | |||
| </td> | |||
| </tr> | |||
| <col width="50%"> | |||
| <col width="50%"> | |||
| <tr> | |||
| <td colspan="2" style="height: 50px;"> | |||
| <h1>DOT language playground</h1> | |||
| <div> | |||
| <a href="javascript: drawExample('example1')">example 1</a> | |||
| <a href="javascript: drawExample('example2')">example 2</a> | |||
| <a href="javascript: drawExample('example3')">example 3</a> | |||
| </div> | |||
| <div> | |||
| <br> | |||
| <button id="draw">Draw</button> | |||
| <span id="error"></span> | |||
| </div> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td> | |||
| <textarea id="data"></textarea> | |||
| </td> | |||
| <td> | |||
| <div id="mygraph"></div> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| <script type="text/javascript"> | |||
| var graph, data; | |||
| var btnDraw = document.getElementById('draw'); | |||
| var txtData = document.getElementById('data'); | |||
| var txtError = document.getElementById('error'); | |||
| btnDraw.onclick = draw; | |||
| // resize the graph when window resizes | |||
| window.onresize = function () { | |||
| graph.redraw() | |||
| }; | |||
| // parse and draw the data | |||
| function draw () { | |||
| try { | |||
| txtError.innerHTML = ''; | |||
| // Provide a string with data in DOT language | |||
| data = { | |||
| dot: txtData.value | |||
| }; | |||
| // create a graph | |||
| var container = document.getElementById('mygraph'); | |||
| var options = {}; | |||
| graph = new vis.Graph(container, data, options); | |||
| } | |||
| catch (err) { | |||
| // set the cursor at the position where the error occurred | |||
| var match = /\(char (.*)\)/.exec(err); | |||
| if (match) { | |||
| var pos = Number(match[1]); | |||
| if(txtData.setSelectionRange) { | |||
| txtData.focus(); | |||
| txtData.setSelectionRange(pos, pos); | |||
| } | |||
| } | |||
| // show an error message | |||
| txtError.innerHTML = err.toString(); | |||
| } | |||
| var graph, data; | |||
| var btnDraw = document.getElementById('draw'); | |||
| var txtData = document.getElementById('data'); | |||
| var txtError = document.getElementById('error'); | |||
| btnDraw.onclick = draw; | |||
| // resize the graph when window resizes | |||
| window.onresize = function () { | |||
| graph.redraw() | |||
| }; | |||
| // parse and draw the data | |||
| function draw () { | |||
| try { | |||
| txtError.innerHTML = ''; | |||
| // Provide a string with data in DOT language | |||
| data = { | |||
| dot: txtData.value | |||
| }; | |||
| // create a graph | |||
| var container = document.getElementById('mygraph'); | |||
| var options = {}; | |||
| graph = new vis.Graph(container, data, options); | |||
| } | |||
| catch (err) { | |||
| // set the cursor at the position where the error occurred | |||
| var match = /\(char (.*)\)/.exec(err); | |||
| if (match) { | |||
| var pos = Number(match[1]); | |||
| if(txtData.setSelectionRange) { | |||
| txtData.focus(); | |||
| txtData.setSelectionRange(pos, pos); | |||
| } | |||
| } | |||
| /** | |||
| * Draw an example | |||
| * @param {String} id HTML id of the textarea containing the example code | |||
| */ | |||
| function drawExample(id) { | |||
| txtData.value = document.getElementById(id).value; | |||
| draw(); | |||
| // show an error message | |||
| txtError.innerHTML = err.toString(); | |||
| } | |||
| } | |||
| /** | |||
| * Draw an example | |||
| * @param {String} id HTML id of the textarea containing the example code | |||
| */ | |||
| function drawExample(id) { | |||
| txtData.value = document.getElementById(id).value; | |||
| draw(); | |||
| } | |||
| </script> | |||
| <textarea id="example1" class="example"> | |||
| digraph { | |||
| node [shape=circle fontSize=16] | |||
| edge [length=100, color=gray, fontColor=black] | |||
| A -> A[label=0.5]; | |||
| B -> B[label=1.2] -> C[label=0.7] -- A; | |||
| B -> D; | |||
| D -> {B; C} | |||
| D -> E[label=0.2]; | |||
| F -> F; | |||
| A [ | |||
| fontColor=white, | |||
| color=red, | |||
| ] | |||
| } | |||
| digraph { | |||
| node [shape=circle fontSize=16] | |||
| edge [length=100, color=gray, fontColor=black] | |||
| A -> A[label=0.5]; | |||
| B -> B[label=1.2] -> C[label=0.7] -- A; | |||
| B -> D; | |||
| D -> {B; C} | |||
| D -> E[label=0.2]; | |||
| F -> F; | |||
| A [ | |||
| fontColor=white, | |||
| color=red, | |||
| ] | |||
| } | |||
| </textarea> | |||
| <textarea id="example2" class="example"> | |||
| digraph topology | |||
| { | |||
| node[shape=circle fontSize=12] | |||
| edge[length=170 fontSize=12] | |||
| "10.0.255.1" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.2" -> "10.0.255.1"[label="1.000"]; | |||
| "10.0.255.2" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.255.1"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.3.0/24"[label="HNA", shape=solid]; | |||
| "10.0.3.0/24"[shape=box]; | |||
| "10.0.255.2" -> "10.0.2.0/24"[label="HNA"]; | |||
| "10.0.2.0/24"[shape=box]; | |||
| "10.0.255.1" -> "10.0.1.0/24"[label="HNA"]; | |||
| "10.0.1.0/24"[shape=box]; | |||
| } | |||
| digraph topology | |||
| { | |||
| node[shape=circle fontSize=12] | |||
| edge[length=170 fontSize=12] | |||
| "10.0.255.1" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.1" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.2" -> "10.0.255.1"[label="1.000"]; | |||
| "10.0.255.2" -> "10.0.255.3"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.255.1"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.255.2"[label="1.000"]; | |||
| "10.0.255.3" -> "10.0.3.0/24"[label="HNA", shape=solid]; | |||
| "10.0.3.0/24"[shape=box]; | |||
| "10.0.255.2" -> "10.0.2.0/24"[label="HNA"]; | |||
| "10.0.2.0/24"[shape=box]; | |||
| "10.0.255.1" -> "10.0.1.0/24"[label="HNA"]; | |||
| "10.0.1.0/24"[shape=box]; | |||
| } | |||
| </textarea> | |||
| <textarea id="example3" class="example"> | |||
| digraph G { | |||
| // note: not all attributes are recognized and supported by Network | |||
| // unrecognized attributes are ignored | |||
| node[width=.25,height=.375,fontsize=15] | |||
| node [shape=filled fillcolor=#F1AAF0] | |||
| 0-> 0 ; | |||
| 1-> 1 ; | |||
| 2-> 2 ; | |||
| 3-> 3 ; | |||
| 4-> 4 ; | |||
| 5-> 5 ; | |||
| 6-> 6 ; | |||
| 7-> 5 ; | |||
| 8-> 8 ; | |||
| 9-> 9 ; | |||
| 10-> 10 ; | |||
| 11-> 10 ; | |||
| 12-> 12 ; | |||
| 13-> 5 ; | |||
| 14-> 10 ; | |||
| 15-> 0 ; | |||
| } | |||
| digraph G { | |||
| // note: not all attributes are recognized and supported by Network | |||
| // unrecognized attributes are ignored | |||
| node[width=.25,height=.375,fontsize=15] | |||
| node [shape=filled fillcolor=#F1AAF0] | |||
| 0-> 0 ; | |||
| 1-> 1 ; | |||
| 2-> 2 ; | |||
| 3-> 3 ; | |||
| 4-> 4 ; | |||
| 5-> 5 ; | |||
| 6-> 6 ; | |||
| 7-> 5 ; | |||
| 8-> 8 ; | |||
| 9-> 9 ; | |||
| 10-> 10 ; | |||
| 11-> 10 ; | |||
| 12-> 12 ; | |||
| 13-> 5 ; | |||
| 14-> 10 ; | |||
| 15-> 0 ; | |||
| } | |||
| </textarea> | |||
| </body> | |||
| @ -1,264 +1,264 @@ | |||
| <!doctype html> | |||
| <html> | |||
| <head> | |||
| <title>Graph | DataSet</title> | |||
| <title>Graph | DataSet</title> | |||
| <style type="text/css"> | |||
| html, body { | |||
| font: 11pt arial; | |||
| } | |||
| <style type="text/css"> | |||
| html, body { | |||
| font: 11pt arial; | |||
| } | |||
| h1 { | |||
| font-size: 150%; | |||
| margin: 5px 0; | |||
| } | |||
| h1 { | |||
| font-size: 150%; | |||
| margin: 5px 0; | |||
| } | |||
| h2 { | |||
| font-size: 100%; | |||
| margin: 5px 0; | |||
| } | |||
| h2 { | |||
| font-size: 100%; | |||
| margin: 5px 0; | |||
| } | |||
| table.view { | |||
| width: 100%; | |||
| } | |||
| table.view { | |||
| width: 100%; | |||
| } | |||
| table td { | |||
| vertical-align: top; | |||
| } | |||
| table td { | |||
| vertical-align: top; | |||
| } | |||
| table table { | |||
| background-color: #f5f5f5; | |||
| border: 1px solid #e5e5e5; | |||
| } | |||
| table table { | |||
| background-color: #f5f5f5; | |||
| border: 1px solid #e5e5e5; | |||
| } | |||
| table table td { | |||
| vertical-align: middle; | |||
| } | |||
| table table td { | |||
| vertical-align: middle; | |||
| } | |||
| input[type=text], pre { | |||
| border: 1px solid lightgray; | |||
| } | |||
| input[type=text], pre { | |||
| border: 1px solid lightgray; | |||
| } | |||
| pre { | |||
| margin: 0; | |||
| padding: 5px; | |||
| font-size: 10pt; | |||
| } | |||
| pre { | |||
| margin: 0; | |||
| padding: 5px; | |||
| font-size: 10pt; | |||
| } | |||
| #graph { | |||
| width: 100%; | |||
| height: 400px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| #graph { | |||
| width: 100%; | |||
| height: 400px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |||
| <script type="text/javascript" src="../../vis.js"></script> | |||
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |||
| <script type="text/javascript" src="../../dist/vis.js"></script> | |||
| <script type="text/javascript"> | |||
| var nodes, edges, graph; | |||
| <script type="text/javascript"> | |||
| var nodes, edges, graph; | |||
| // convenience method to stringify a JSON object | |||
| function toJSON (obj) { | |||
| return JSON.stringify(obj, null, 4); | |||
| } | |||
| // convenience method to stringify a JSON object | |||
| function toJSON (obj) { | |||
| return JSON.stringify(obj, null, 4); | |||
| } | |||
| $(window).load(function () { | |||
| // attach actions to the node buttons | |||
| $('#node-add').click(function () { | |||
| try { | |||
| nodes.add({ | |||
| id: $('#node-id').val(), | |||
| label: $('#node-label').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#node-update').click(function () { | |||
| try { | |||
| nodes.update({ | |||
| id: $('#node-id').val(), | |||
| label: $('#node-label').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#node-remove').click(function () { | |||
| try { | |||
| var id = $('#node-id').val(); | |||
| nodes.remove(id); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $(window).load(function () { | |||
| // attach actions to the node buttons | |||
| $('#node-add').click(function () { | |||
| try { | |||
| nodes.add({ | |||
| id: $('#node-id').val(), | |||
| label: $('#node-label').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#node-update').click(function () { | |||
| try { | |||
| nodes.update({ | |||
| id: $('#node-id').val(), | |||
| label: $('#node-label').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#node-remove').click(function () { | |||
| try { | |||
| var id = $('#node-id').val(); | |||
| nodes.remove(id); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| // attach actions to the edge buttons | |||
| $('#edge-add').click(function () { | |||
| try { | |||
| edges.add({ | |||
| id: $('#edge-id').val(), | |||
| from: $('#edge-from').val(), | |||
| to: $('#edge-to').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#edge-update').click(function () { | |||
| try { | |||
| edges.update({ | |||
| id: $('#edge-id').val(), | |||
| from: $('#edge-from').val(), | |||
| to: $('#edge-to').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#edge-remove').click(function () { | |||
| try { | |||
| var id = $('#edge-id').val(); | |||
| edges.remove(id); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| // attach actions to the edge buttons | |||
| $('#edge-add').click(function () { | |||
| try { | |||
| edges.add({ | |||
| id: $('#edge-id').val(), | |||
| from: $('#edge-from').val(), | |||
| to: $('#edge-to').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#edge-update').click(function () { | |||
| try { | |||
| edges.update({ | |||
| id: $('#edge-id').val(), | |||
| from: $('#edge-from').val(), | |||
| to: $('#edge-to').val() | |||
| }); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| $('#edge-remove').click(function () { | |||
| try { | |||
| var id = $('#edge-id').val(); | |||
| edges.remove(id); | |||
| } | |||
| catch (err) { | |||
| alert(err); | |||
| } | |||
| }); | |||
| // create an array with nodes | |||
| nodes = new vis.DataSet(); | |||
| nodes.subscribe('*', function () { | |||
| $('#nodes').html(toJSON(nodes.get())); | |||
| }); | |||
| nodes.add([ | |||
| {id: '1', label: 'Node 1'}, | |||
| {id: '2', label: 'Node 2'}, | |||
| {id: '3', label: 'Node 3'}, | |||
| {id: '4', label: 'Node 4'}, | |||
| {id: '5', label: 'Node 5'} | |||
| ]); | |||
| // create an array with nodes | |||
| nodes = new vis.DataSet(); | |||
| nodes.subscribe('*', function () { | |||
| $('#nodes').html(toJSON(nodes.get())); | |||
| }); | |||
| nodes.add([ | |||
| {id: '1', label: 'Node 1'}, | |||
| {id: '2', label: 'Node 2'}, | |||
| {id: '3', label: 'Node 3'}, | |||
| {id: '4', label: 'Node 4'}, | |||
| {id: '5', label: 'Node 5'} | |||
| ]); | |||
| // create an array with edges | |||
| edges = new vis.DataSet(); | |||
| edges.subscribe('*', function () { | |||
| $('#edges').html(toJSON(edges.get())); | |||
| }); | |||
| edges.add([ | |||
| {id: '1', from: '1', to: '2'}, | |||
| {id: '2', from: '1', to: '3'}, | |||
| {id: '3', from: '2', to: '4'}, | |||
| {id: '4', from: '2', to: '5'} | |||
| ]); | |||
| // create an array with edges | |||
| edges = new vis.DataSet(); | |||
| edges.subscribe('*', function () { | |||
| $('#edges').html(toJSON(edges.get())); | |||
| }); | |||
| edges.add([ | |||
| {id: '1', from: '1', to: '2'}, | |||
| {id: '2', from: '1', to: '3'}, | |||
| {id: '3', from: '2', to: '4'}, | |||
| {id: '4', from: '2', to: '5'} | |||
| ]); | |||
| // create a graph | |||
| var container = $('#graph').get(0); | |||
| var data = { | |||
| nodes: nodes, | |||
| edges: edges | |||
| }; | |||
| var options = {}; | |||
| graph = new vis.Graph(container, data, options); | |||
| }); | |||
| </script> | |||
| // create a graph | |||
| var container = $('#graph').get(0); | |||
| var data = { | |||
| nodes: nodes, | |||
| edges: edges | |||
| }; | |||
| var options = {}; | |||
| graph = new vis.Graph(container, data, options); | |||
| }); | |||
| </script> | |||
| </head> | |||
| <body> | |||
| <p> | |||
| This example demonstrates dynamically adding, updating and removing nodes | |||
| and edges using a DataSet. | |||
| This example demonstrates dynamically adding, updating and removing nodes | |||
| and edges using a DataSet. | |||
| </p> | |||
| <h1>Adjust</h1> | |||
| <table> | |||
| <tr> | |||
| <td> | |||
| <h2>Node</h2> | |||
| <table> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="node-id">Id</label></td> | |||
| <td><input id="node-id" type="text" value="6"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="node-label">Label</label></td> | |||
| <td><input id="node-label" type="text" value="Node 6"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td>Action</td> | |||
| <td> | |||
| <button id="node-add">Add</button> | |||
| <button id="node-update">Update</button> | |||
| <button id="node-remove">Remove</button> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| </td> | |||
| <td> | |||
| <h2>Edge</h2> | |||
| <table> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-id">Id</label></td> | |||
| <td><input id="edge-id" type="text" value="5"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-from">From</label></td> | |||
| <td><input id="edge-from" type="text" value="3"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-to">To</label></td> | |||
| <td><input id="edge-to" type="text" value="4"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td>Action</td> | |||
| <td> | |||
| <button id="edge-add">Add</button> | |||
| <button id="edge-update">Update</button> | |||
| <button id="edge-remove">Remove</button> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td> | |||
| <h2>Node</h2> | |||
| <table> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="node-id">Id</label></td> | |||
| <td><input id="node-id" type="text" value="6"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="node-label">Label</label></td> | |||
| <td><input id="node-label" type="text" value="Node 6"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td>Action</td> | |||
| <td> | |||
| <button id="node-add">Add</button> | |||
| <button id="node-update">Update</button> | |||
| <button id="node-remove">Remove</button> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| </td> | |||
| <td> | |||
| <h2>Edge</h2> | |||
| <table> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-id">Id</label></td> | |||
| <td><input id="edge-id" type="text" value="5"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-from">From</label></td> | |||
| <td><input id="edge-from" type="text" value="3"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td><label for="edge-to">To</label></td> | |||
| <td><input id="edge-to" type="text" value="4"></td> | |||
| </tr> | |||
| <tr> | |||
| <td></td> | |||
| <td>Action</td> | |||
| <td> | |||
| <button id="edge-add">Add</button> | |||
| <button id="edge-update">Update</button> | |||
| <button id="edge-remove">Remove</button> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| <h1>View</h1> | |||
| <table class="view"> | |||
| <colgroup> | |||
| <col width="25%"> | |||
| <col width="25%"> | |||
| <col width="50%"> | |||
| </colgroup> | |||
| <tr> | |||
| <td> | |||
| <h2>Nodes</h2> | |||
| <pre id="nodes"></pre> | |||
| </td> | |||
| <colgroup> | |||
| <col width="25%"> | |||
| <col width="25%"> | |||
| <col width="50%"> | |||
| </colgroup> | |||
| <tr> | |||
| <td> | |||
| <h2>Nodes</h2> | |||
| <pre id="nodes"></pre> | |||
| </td> | |||
| <td> | |||
| <h2>Edges</h2> | |||
| <pre id="edges"></pre> | |||
| </td> | |||
| <td> | |||
| <h2>Edges</h2> | |||
| <pre id="edges"></pre> | |||
| </td> | |||
| <td> | |||
| <h2>Graph</h2> | |||
| <div id="graph"></div> | |||
| </td> | |||
| </tr> | |||
| <td> | |||
| <h2>Graph</h2> | |||
| <div id="graph"></div> | |||
| </td> | |||
| </tr> | |||
| </table> | |||
| </body> | |||
| @ -1,86 +1,86 @@ | |||
| <html> | |||
| <head> | |||
| <title>Graph | Graphviz Gallery</title> | |||
| <title>Graph | Graphviz Gallery</title> | |||
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |||
| <script type="text/javascript" src="../../../vis.js"></script> | |||
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |||
| <script type="text/javascript" src="../../../dist/vis.js"></script> | |||
| <style type="text/css"> | |||
| p { | |||
| width: 600px; | |||
| } | |||
| html, body, select { | |||
| font: 11pt arial; | |||
| } | |||
| #mygraph { | |||
| width: 100%; | |||
| height: 600px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| <style type="text/css"> | |||
| p { | |||
| width: 600px; | |||
| } | |||
| html, body, select { | |||
| font: 11pt arial; | |||
| } | |||
| #mygraph { | |||
| width: 100%; | |||
| height: 600px; | |||
| border: 1px solid lightgray; | |||
| } | |||
| </style> | |||
| </head> | |||
| <body> | |||
| <script> | |||
| if (location.href.substr(0, 5) == 'file:') { | |||
| document.write( | |||
| '<p style="color: red;">' + | |||
| 'Error: Cannot fetch the example data because of security ' + | |||
| 'restrictions in JavaScript. Run the example from a server ' + | |||
| 'instead of as a local file to resolve this problem. ' + | |||
| 'Alternatively, you can load DOT graphs in ' + | |||
| 'the <a href="../15_dot_language_playground.html" ' + | |||
| 'style="color:red;">playground</a>.' + | |||
| if (location.href.substr(0, 5) == 'file:') { | |||
| document.write( | |||
| '<p style="color: red;">' + | |||
| 'Error: Cannot fetch the example data because of security ' + | |||
| 'restrictions in JavaScript. Run the example from a server ' + | |||
| 'instead of as a local file to resolve this problem. ' + | |||
| 'Alternatively, you can load DOT graphs in ' + | |||
| 'the <a href="../15_dot_language_playground.html" ' + | |||
| 'style="color:red;">playground</a>.' + | |||
| '</p>'); | |||
| } | |||
| } | |||
| </script> | |||
| <p> | |||
| The following examples are unmodified copies from the | |||
| <a href="http://www.graphviz.org/Gallery.php" target="_blank">Graphviz Gallery</a>. | |||
| The following examples are unmodified copies from the | |||
| <a href="http://www.graphviz.org/Gallery.php" target="_blank">Graphviz Gallery</a>. | |||
| </p> | |||
| <p> | |||
| Note that some style attributes of Graphviz are not supported by vis.js, | |||
| and that vis.js offers options not supported by Graphviz (which could make | |||
| some examples look much nicer). | |||
| Note that some style attributes of Graphviz are not supported by vis.js, | |||
| and that vis.js offers options not supported by Graphviz (which could make | |||
| some examples look much nicer). | |||
| </p> | |||
| <p> | |||
| <label for="url">Select an example:</label> | |||
| <select id="url" onchange="loadData()"> | |||
| <option value="data/fsm.gv.txt">fsm</option> | |||
| <option value="data/hello.gv.txt">hello</option> | |||
| <option value="data/process.gv.txt">process</option> | |||
| <option value="data/siblings.gv.txt">siblings</option> | |||
| <option value="data/softmaint.gv.txt">softmaint</option> | |||
| <option value="data/traffic_lights.gv.txt">traffic_lights</option> | |||
| <option value="data/transparency.gv.txt">transparency</option> | |||
| <option value="data/twopi2.gv.txt">twopi2</option> | |||
| <option value="data/unix.gv.txt">unix</option> | |||
| <option value="data/world.gv.txt">world</option> | |||
| </select> | |||
| <label for="url">Select an example:</label> | |||
| <select id="url" onchange="loadData()"> | |||
| <option value="data/fsm.gv.txt">fsm</option> | |||
| <option value="data/hello.gv.txt">hello</option> | |||
| <option value="data/process.gv.txt">process</option> | |||
| <option value="data/siblings.gv.txt">siblings</option> | |||
| <option value="data/softmaint.gv.txt">softmaint</option> | |||
| <option value="data/traffic_lights.gv.txt">traffic_lights</option> | |||
| <option value="data/transparency.gv.txt">transparency</option> | |||
| <option value="data/twopi2.gv.txt">twopi2</option> | |||
| <option value="data/unix.gv.txt">unix</option> | |||
| <option value="data/world.gv.txt">world</option> | |||
| </select> | |||
| </p> | |||
| <div id="mygraph"></div> | |||
| <script type="text/javascript"> | |||
| var container = document.getElementById('mygraph'); | |||
| var url = document.getElementById('url'); | |||
| var graph = new vis.Graph(container); | |||
| var container = document.getElementById('mygraph'); | |||
| var url = document.getElementById('url'); | |||
| var graph = new vis.Graph(container); | |||
| function loadData () { | |||
| $.ajax({ | |||
| type: "GET", | |||
| url: url.value | |||
| }).done(function(data) { | |||
| graph.setOptions({ | |||
| stabilize: false | |||
| }); | |||
| graph.setData( { | |||
| dot: data | |||
| }); | |||
| function loadData () { | |||
| $.ajax({ | |||
| type: "GET", | |||
| url: url.value | |||
| }).done(function(data) { | |||
| graph.setOptions({ | |||
| stabilize: false | |||
| }); | |||
| graph.setData( { | |||
| dot: data | |||
| }); | |||
| }); | |||
| } | |||
| loadData(); | |||
| } | |||
| loadData(); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @ -1,31 +1,32 @@ | |||
| <!DOCTYPE HTML> | |||
| <html> | |||
| <head> | |||
| <title>Timeline | Basic demo</title> | |||
| <title>Timeline | Basic demo</title> | |||
| <style type="text/css"> | |||
| body, html { | |||
| font-family: sans-serif; | |||
| } | |||
| </style> | |||
| <style type="text/css"> | |||
| body, html { | |||
| font-family: sans-serif; | |||
| } | |||
| </style> | |||
| <script src="../../vis.js"></script> | |||
| <script src="../../dist/vis.js"></script> | |||
| <link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
| </head> | |||
| <body> | |||
| <div id="visualization"></div> | |||
| <script type="text/javascript"> | |||
| var container = document.getElementById('visualization'); | |||
| var items = [ | |||
| {id: 1, content: 'item 1', start: '2013-04-20'}, | |||
| {id: 2, content: 'item 2', start: '2013-04-14'}, | |||
| {id: 3, content: 'item 3', start: '2013-04-18'}, | |||
| {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: 'item 5', start: '2013-04-25'}, | |||
| {id: 6, content: 'item 6', start: '2013-04-27'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| var container = document.getElementById('visualization'); | |||
| var items = [ | |||
| {id: 1, content: 'item 1', start: '2013-04-20'}, | |||
| {id: 2, content: 'item 2', start: '2013-04-14'}, | |||
| {id: 3, content: 'item 3', start: '2013-04-18'}, | |||
| {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: 'item 5', start: '2013-04-25'}, | |||
| {id: 6, content: 'item 6', start: '2013-04-27'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @ -1,60 +1,62 @@ | |||
| <!DOCTYPE HTML> | |||
| <html> | |||
| <head> | |||
| <title>Timeline | Dataset example</title> | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| height: 100%; | |||
| margin: 0; | |||
| padding: 0; | |||
| } | |||
| #visualization { | |||
| box-sizing: border-box; | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| </style> | |||
| <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||
| <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||
| <script src="../../vis.js"></script> | |||
| <title>Timeline | Dataset example</title> | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| height: 100%; | |||
| margin: 0; | |||
| padding: 0; | |||
| } | |||
| #visualization { | |||
| box-sizing: border-box; | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| </style> | |||
| <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||
| <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||
| <script src="../../dist/vis.js"></script> | |||
| <link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
| </head> | |||
| <body> | |||
| <div id="visualization"></div> | |||
| <script> | |||
| var now = moment().minutes(0).seconds(0).milliseconds(0); | |||
| // create a dataset with items | |||
| var items = new vis.DataSet({ | |||
| convert: { | |||
| start: 'Date', | |||
| end: 'Date' | |||
| } | |||
| }); | |||
| items.add([ | |||
| {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)}, | |||
| {id: 2, content: 'item 2', start: now.clone().add('days', -2)}, | |||
| {id: 3, content: 'item 3', start: now.clone().add('days', 2)}, | |||
| {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()}, | |||
| {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'}, | |||
| {id: 6, content: 'item 6', start: now.clone().add('days', 11)} | |||
| ]); | |||
| var container = document.getElementById('visualization'); | |||
| var options = { | |||
| start: now.clone().add('days', -3), | |||
| end: now.clone().add('days', 7), | |||
| orientation: 'top', | |||
| height: '100%' | |||
| }; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| var now = moment().minutes(0).seconds(0).milliseconds(0); | |||
| // create a dataset with items | |||
| var items = new vis.DataSet({ | |||
| convert: { | |||
| start: 'Date', | |||
| end: 'Date' | |||
| } | |||
| }); | |||
| items.add([ | |||
| {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)}, | |||
| {id: 2, content: 'item 2', start: now.clone().add('days', -2)}, | |||
| {id: 3, content: 'item 3', start: now.clone().add('days', 2)}, | |||
| {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()}, | |||
| {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'}, | |||
| {id: 6, content: 'item 6', start: now.clone().add('days', 11)} | |||
| ]); | |||
| var container = document.getElementById('visualization'); | |||
| var options = { | |||
| start: now.clone().add('days', -3), | |||
| end: now.clone().add('days', 7), | |||
| orientation: 'top', | |||
| height: '100%', | |||
| showCurrentTime: true | |||
| }; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| </script> | |||
| </body> | |||
| @ -1,69 +1,74 @@ | |||
| <!DOCTYPE HTML> | |||
| <html> | |||
| <head> | |||
| <title>Timeline | HTML data</title> | |||
| <title>Timeline | HTML data</title> | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| } | |||
| span { | |||
| color: red; | |||
| } | |||
| span.large { | |||
| font-size: 200%; | |||
| } | |||
| </style> | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| } | |||
| span { | |||
| color: red; | |||
| } | |||
| span.large { | |||
| font-size: 200%; | |||
| } | |||
| </style> | |||
| <script src="../../dist/vis.js"></script> | |||
| <link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
| <script src="../../vis.js"></script> | |||
| </head> | |||
| <body> | |||
| <p> | |||
| Load HTML contents in the Timeline | |||
| Load HTML contents in the Timeline | |||
| </p> | |||
| <div id="visualization"></div> | |||
| <script> | |||
| // create a couple of HTML items in various ways | |||
| // create a couple of HTML items in various ways | |||
| var item1 = document.createElement('div'); | |||
| item1.appendChild(document.createTextNode('item 1')); | |||
| var item1 = document.createElement('div'); | |||
| item1.appendChild(document.createTextNode('item 1')); | |||
| var item2 = document.createElement('div'); | |||
| item2.innerHTML = '<span>item 2</span>'; | |||
| var item2 = document.createElement('div'); | |||
| item2.innerHTML = '<span>item 2</span>'; | |||
| var item3 = document.createElement('div'); | |||
| var span3 = document.createElement('span'); | |||
| span3.className = 'large'; | |||
| span3.appendChild(document.createTextNode('item 3')); | |||
| item3.appendChild(span3); | |||
| var item3 = document.createElement('div'); | |||
| var span3 = document.createElement('span'); | |||
| span3.className = 'large'; | |||
| span3.appendChild(document.createTextNode('item 3')); | |||
| item3.appendChild(span3); | |||
| var item4 = 'item <span class="large">4</span>'; | |||
| var item4 = 'item <span class="large">4</span>'; | |||
| var item5 = document.createElement('div'); | |||
| item5.appendChild(document.createTextNode('item 5')); | |||
| item5.appendChild(document.createElement('br')); | |||
| var img5 = document.createElement('img'); | |||
| img5.src = 'img/attachment-icon.png'; | |||
| img5.style.width = '48px'; | |||
| img5.style.height = '48px'; | |||
| item5.appendChild(img5); | |||
| var item5 = document.createElement('div'); | |||
| item5.appendChild(document.createTextNode('item 5')); | |||
| item5.appendChild(document.createElement('br')); | |||
| var img5 = document.createElement('img'); | |||
| img5.src = 'img/attachment-icon.png'; | |||
| img5.style.width = '48px'; | |||
| img5.style.height = '48px'; | |||
| item5.appendChild(img5); | |||
| var item6 = 'item6<br><img src="img/comments-icon.png" style="width: 48px; height: 48px;">'; | |||
| var item6 = 'item6<br><img src="img/comments-icon.png" style="width: 48px; height: 48px;">'; | |||
| var item7 = 'item7<br><a href="http://visjs.org" target="_blank">click here</a>'; | |||
| // create data and a Timeline | |||
| var container = document.getElementById('visualization'); | |||
| var items = [ | |||
| {id: 1, content: item1, start: '2013-04-20'}, | |||
| {id: 2, content: item2, start: '2013-04-14'}, | |||
| {id: 3, content: item3, start: '2013-04-18'}, | |||
| {id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: item5, start: '2013-04-25'}, | |||
| {id: 6, content: item6, start: '2013-04-27'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| // create data and a Timeline | |||
| var container = document.getElementById('visualization'); | |||
| var items = [ | |||
| {id: 1, content: item1, start: '2013-04-20'}, | |||
| {id: 2, content: item2, start: '2013-04-14'}, | |||
| {id: 3, content: item3, start: '2013-04-18'}, | |||
| {id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: item5, start: '2013-04-25'}, | |||
| {id: 6, content: item6, start: '2013-04-27'}, | |||
| {id: 7, content: item7, start: '2013-04-21'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, items, options); | |||
| </script> | |||
| </body> | |||
| </html> | |||
| @ -1,71 +1,72 @@ | |||
| <!DOCTYPE HTML> | |||
| <html> | |||
| <head> | |||
| <title>Timeline | Group example</title> | |||
| <title>Timeline | Group example</title> | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| } | |||
| <style> | |||
| body, html { | |||
| font-family: arial, sans-serif; | |||
| font-size: 11pt; | |||
| } | |||
| #visualization { | |||
| box-sizing: border-box; | |||
| width: 100%; | |||
| height: 300px; | |||
| } | |||
| </style> | |||
| #visualization { | |||
| box-sizing: border-box; | |||
| width: 100%; | |||
| height: 300px; | |||
| } | |||
| </style> | |||
| <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||
| <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||
| <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||
| <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||
| <script src="../../vis.js"></script> | |||
| <script src="../../dist/vis.js"></script> | |||
| <link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
| </head> | |||
| <body> | |||
| <p> | |||
| This example demonstrate using groups. Note that a DataSet is used for both | |||
| items and groups, allowing to dynamically add, update or remove both items | |||
| and groups via the DataSet. | |||
| This example demonstrate using groups. Note that a DataSet is used for both | |||
| items and groups, allowing to dynamically add, update or remove both items | |||
| and groups via the DataSet. | |||
| </p> | |||
| <div id="visualization"></div> | |||
| <script> | |||
| var now = moment().minutes(0).seconds(0).milliseconds(0); | |||
| var groupCount = 3; | |||
| var itemCount = 20; | |||
| var now = moment().minutes(0).seconds(0).milliseconds(0); | |||
| var groupCount = 3; | |||
| var itemCount = 20; | |||
| // create a data set with groups | |||
| var names = ['John', 'Alston', 'Lee', 'Grant']; | |||
| var groups = new vis.DataSet(); | |||
| for (var g = 0; g < groupCount; g++) { | |||
| groups.add({id: g, content: names[g]}); | |||
| } | |||
| // create a data set with groups | |||
| var names = ['John', 'Alston', 'Lee', 'Grant']; | |||
| var groups = new vis.DataSet(); | |||
| for (var g = 0; g < groupCount; g++) { | |||
| groups.add({id: g, content: names[g]}); | |||
| } | |||
| // create a dataset with items | |||
| var items = new vis.DataSet(); | |||
| for (var i = 0; i < itemCount; i++) { | |||
| var start = now.clone().add('hours', Math.random() * 200); | |||
| var group = Math.floor(Math.random() * groupCount); | |||
| items.add({ | |||
| id: i, | |||
| group: group, | |||
| content: 'item ' + i + | |||
| ' <span style="color:#97B0F8;">(' + names[group] + ')</span>', | |||
| start: start, | |||
| type: 'box' | |||
| }); | |||
| } | |||
| // create a dataset with items | |||
| var items = new vis.DataSet(); | |||
| for (var i = 0; i < itemCount; i++) { | |||
| var start = now.clone().add('hours', Math.random() * 200); | |||
| var group = Math.floor(Math.random() * groupCount); | |||
| items.add({ | |||
| id: i, | |||
| group: group, | |||
| content: 'item ' + i + | |||
| ' <span style="color:#97B0F8;">(' + names[group] + ')</span>', | |||
| start: start, | |||
| type: 'box' | |||
| }); | |||
| } | |||
| // create visualization | |||
| var container = document.getElementById('visualization'); | |||
| var options = { | |||
| groupsOrder: 'content' | |||
| }; | |||
| // create visualization | |||
| var container = document.getElementById('visualization'); | |||
| var options = { | |||
| groupOrder: 'content' | |||
| }; | |||
| var timeline = new vis.Timeline(container); | |||
| timeline.setOptions(options); | |||
| timeline.setGroups(groups); | |||
| timeline.setItems(items); | |||
| var timeline = new vis.Timeline(container); | |||
| timeline.setOptions(options); | |||
| timeline.setGroups(groups); | |||
| timeline.setItems(items); | |||
| </script> | |||
| </body> | |||
| @ -1,11 +1,13 @@ | |||
| <!DOCTYPE HTML> | |||
| <html> | |||
| <head> | |||
| <title>Timeline requirejs demo</title> | |||
| <title>Timeline requirejs demo</title> | |||
| <script data-main="scripts/main" src="scripts/require.js"></script> | |||
| <script data-main="scripts/main" src="scripts/require.js"></script> | |||
| <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
| </head> | |||
| <body> | |||
| <div id="visualization"></div> | |||
| <div id="visualization"></div> | |||
| </body> | |||
| </html> | |||
| @ -1,19 +1,19 @@ | |||
| require.config({ | |||
| paths: { | |||
| vis: '../../../../vis' | |||
| } | |||
| paths: { | |||
| vis: '../../../../dist/vis' | |||
| } | |||
| }); | |||
| require(['vis'], function (vis) { | |||
| var container = document.getElementById('visualization'); | |||
| var data = [ | |||
| {id: 1, content: 'item 1', start: '2013-04-20'}, | |||
| {id: 2, content: 'item 2', start: '2013-04-14'}, | |||
| {id: 3, content: 'item 3', start: '2013-04-18'}, | |||
| {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: 'item 5', start: '2013-04-25'}, | |||
| {id: 6, content: 'item 6', start: '2013-04-27'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, data, options); | |||
| var container = document.getElementById('visualization'); | |||
| var data = [ | |||
| {id: 1, content: 'item 1', start: '2013-04-20'}, | |||
| {id: 2, content: 'item 2', start: '2013-04-14'}, | |||
| {id: 3, content: 'item 3', start: '2013-04-18'}, | |||
| {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||
| {id: 5, content: 'item 5', start: '2013-04-25'}, | |||
| {id: 6, content: 'item 6', start: '2013-04-27'} | |||
| ]; | |||
| var options = {}; | |||
| var timeline = new vis.Timeline(container, data, options); | |||
| }); | |||