added dot and gephi parser to docs, need to include examples in the docs everywhere. Added working example code at the top of the docs and link to example 1
console.log('The dot property has been depricated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);');
// parse DOT file
// parse DOT file
if(data&&data.dot){
vardotData=dotparser.DOTToGraph(data.dot);
this.setData(dotData);
return;
}
vardotData=dotparser.DOTToGraph(data.dot);
this.setData(dotData);
return;
}elseif(data&&data.gephi){
}elseif(data&&data.gephi){
// parse DOT file
// parse DOT file
if(data&&data.gephi){
vargephiData=gephiParser.parseGephi(data.gephi);
this.setData(gephiData);
return;
}
console.log('The gephi property has been depricated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);');
An example exists showing how to get a JSON file into Vis: <ahref="../examples/network/30_importing_from_gephi.html">30_importing_from_gephi</a>.
</p>
<p>
Example usage:
</p>
<preclass="prettyprint lang-js">
// load the JSON file containing the Gephi network.
var gephiJSON = loadJSON("./data/WorldCup2014.json"); // code in example 30
// create a data object with the gephi key:
var data = {
gephi: gephiJSON
};
// create a network
var network = new vis.Network(container, data);
</pre>
Alternatively you can use the parser manually:
<preclass="prettyprint lang-js">
// load the JSON file containing the Gephi network.
var gephiJSON = loadJSON("./data/WorldCup2014.json"); // code in example 30
// parse the gephi file to receive an object
// containing nodes and edges in vis format.
var parsed = vis.network.gephiParser.parseGephi(gephiJSON);
// provide data in the normal fashion
var data = {
nodes: parsed.nodes,
edged: parsed.edges
};
// create a network
var network = new vis.Network(container, data);
</pre>
<h4>Gephi parser options</h4>
There are a few options you can use to tell Vis what to do with the data from Gephi.
<preclass="prettyprint lang-js">
var parserOptions = {
allowedToMove: false,
parseColor: false
}
var parsed = vis.network.gephiParser.parseGephi(gephiJSON, parserOptions);
</pre>
<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>allowedToMove</td>
<td>Boolean</td>
<td>false</td>
<td>
If true, the nodes will move according to the physics model after import. If false, the nodes do not move at all.
</td>
</tr>
<tr>
<td>parseColor</td>
<td>Boolean</td>
<td>false</td>
<td>
If true, the color will be parsed by the vis parser, generating extra colors for the borders, highlighs and hover. If false, the node will be the supplied color.
var container = document.getElementById('mynetwork');
// provide the data in the vis format
var data = {
nodes: nodes,
edges: edges
};
var options = {};
// initialize your network!
var network = new vis.Network(container, data, options);
</script>
</body>
</html>
</pre>
<p><ahref="http://visjs.org/examples/network/01_basic_usage.html"target="_blank">The result of the code above will be the basic example which is shown here.</a></p>
targetNode="gephiDiv"><a>Importing from Gephi</a></li>
</ul>
</ul>
<br>
<br>
@ -253,6 +345,7 @@ network.setOptions(options);
<br>
<br>
<br>
<br>
<h4id="locales">Custom locales</h4>
<h4id="locales">Custom locales</h4>
<p>The locales object has the following format:</p>
<p>The locales object has the following format:</p>
<preclass="prettyprint lang-js">
<preclass="prettyprint lang-js">
var locales = {
var locales = {
@ -272,7 +365,8 @@ var locales = {
editClusterError: 'Clusters cannot be edited.'
editClusterError: 'Clusters cannot be edited.'
}
}
}</pre>
}</pre>
<p>If you want to define your own locale, you can change the key ('en' here) and change all the string. You can then use your new key in the locale option.</p>
<p>If you want to define your own locale, you can change the key ('en' here) and change all the string. You can
@ -304,20 +304,18 @@ Network.prototype.setData = function (data) {
this.setOptions(data&&data.options);
this.setOptions(data&&data.options);
// set all data
// set all data
if(data&&data.dot){
if(data&&data.dot){
console.log('The dot property has been depricated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);');
// parse DOT file
// parse DOT file
if(data&&data.dot){
vardotData=dotparser.DOTToGraph(data.dot);
this.setData(dotData);
return;
}
vardotData=dotparser.DOTToGraph(data.dot);
this.setData(dotData);
return;
}
}
elseif(data&&data.gephi){
elseif(data&&data.gephi){
// parse DOT file
// parse DOT file
if(data&&data.gephi){
vargephiData=gephiParser.parseGephi(data.gephi);
this.setData(gephiData);
return;
}
console.log('The gephi property has been depricated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);');