Browse Source

fixed docs (added tabs) fixed gephiparser, fixed edges, labels on selfreferenced edges, fixed dotlanguage

flowchartTest
Alex de Mulder 9 years ago
parent
commit
f81b41c16b
10 changed files with 13614 additions and 13273 deletions
  1. +12664
    -12404
      dist/vis.js
  2. +1
    -1
      docs/css/newdocs.css
  3. +10
    -7
      docs/js/toggleTable.js
  4. +2
    -2
      docs/network/edges.html
  5. +918
    -839
      docs/network/new_network.html
  6. +1
    -2
      examples/network/01_basic_usage.html
  7. +3
    -2
      lib/network/dotparser.js
  8. +11
    -11
      lib/network/gephiParser.js
  9. +1
    -1
      lib/network/modules/EdgesHandler.js
  10. +3
    -4
      lib/network/modules/components/Edge.js

+ 12664
- 12404
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
docs/css/newdocs.css View File

@ -182,7 +182,7 @@ td.default {
} }
td.eventProperties { td.eventProperties {
width:350px;
width:150px;
} }
td.methodName { td.methodName {

+ 10
- 7
docs/js/toggleTable.js View File

@ -57,22 +57,25 @@ function toggleTable(tableId, parent, clickedRow) {
} }
} }
function toggleTab(showTabId, showPreId, hideTabId, hidePreId) {
function toggleTab(showTabId, showDOMid, hideTabId, hideDOMid, hideTabId2, hideDOMid2) {
if (hideTabId2 !== undefined) {
document.getElementById(hideTabId2).className = '';
document.getElementById(hideDOMid2).className = document.getElementById(hideDOMid2).className.replace(' hidden','');
document.getElementById(hideDOMid2).className += ' hidden';
}
if (hideTabId !== undefined) { if (hideTabId !== undefined) {
document.getElementById(hideTabId).className = ''; document.getElementById(hideTabId).className = '';
document.getElementById(hidePreId).className = document.getElementById(hidePreId).className.replace(' hidden','');
document.getElementById(hidePreId).className += ' hidden';
document.getElementById(hideDOMid).className = document.getElementById(hideDOMid).className.replace(' hidden','');
document.getElementById(hideDOMid).className += ' hidden';
} }
document.getElementById('hiddenTab').className = '';
document.getElementById(showTabId).className = 'active'; document.getElementById(showTabId).className = 'active';
document.getElementById(showPreId).className = document.getElementById(showPreId).className.replace(' hidden','');
document.getElementById(showDOMid).className = document.getElementById(showDOMid).className.replace(' hidden','');
} }
function hideOptions(hideTabId1, hidePreId1, hideTabId2, hidePreId2) { function hideOptions(hideTabId1, hidePreId1, hideTabId2, hidePreId2) {
document.getElementById('hiddenTab').className = 'active';
document.getElementById(hideTabId1).className = ''; document.getElementById(hideTabId1).className = '';
document.getElementById(hidePreId1).className = document.getElementById(hidePreId1).className.replace(' hidden',''); document.getElementById(hidePreId1).className = document.getElementById(hidePreId1).className.replace(' hidden','');
document.getElementById(hidePreId1).className += ' hidden'; document.getElementById(hidePreId1).className += ' hidden';

+ 2
- 2
docs/network/edges.html View File

@ -121,7 +121,7 @@ var options = {
size: 14, // px size: 14, // px
face: 'arial', face: 'arial',
background: 'none', background: 'none',
strokeWidth: 1, // px
strokeWidth: 2, // px
strokeColor: '#ffffff', strokeColor: '#ffffff',
align:'horizontal' align:'horizontal'
}, },
@ -344,7 +344,7 @@ network.setOptions(options);
<tr parent="font" class="hidden"> <tr parent="font" class="hidden">
<td class="indent">font.strokeWidth</td> <td class="indent">font.strokeWidth</td>
<td class="mid">Number</td> <td class="mid">Number</td>
<td class="mid"><code>0</code></td>
<td class="mid"><code>2</code></td>
<td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value
higher than 0 is supplied, the stroke will be drawn. higher than 0 is supplied, the stroke will be drawn.
</td> </td>

+ 918
- 839
docs/network/new_network.html
File diff suppressed because it is too large
View File


+ 1
- 2
examples/network/01_basic_usage.html View File

@ -34,7 +34,6 @@
// create an array with edges // create an array with edges
var edges = new vis.DataSet([ var edges = new vis.DataSet([
{from: 1, to: 1},
{from: 1, to: 3}, {from: 1, to: 3},
{from: 1, to: 2}, {from: 1, to: 2},
{from: 2, to: 4}, {from: 2, to: 4},
@ -47,7 +46,7 @@
nodes: nodes, nodes: nodes,
edges: edges edges: edges
}; };
var options = {loale:'en'};
var options = {locale:'en'};
var network = new vis.Network(container, data, options); var network = new vis.Network(container, data, options);
</script> </script>

+ 3
- 2
lib/network/dotparser.js View File

@ -767,7 +767,8 @@ function DOTToGraph (data) {
to: dotEdge.to to: dotEdge.to
}; };
merge(graphEdge, dotEdge.attr); merge(graphEdge, dotEdge.attr);
graphEdge.style = (dotEdge.type === '->') ? 'arrow' : 'line';
graphEdge.arrows = (dotEdge.type === '->') ? 'to' : undefined;
return graphEdge; return graphEdge;
}; };
@ -822,5 +823,5 @@ function DOTToGraph (data) {
} }
// exports // exports
exports.parseDOT = parseDOT;
exports.parseDOT = parseDOT;
exports.DOTToGraph = DOTToGraph; exports.DOTToGraph = DOTToGraph;

+ 11
- 11
lib/network/gephiParser.js View File

@ -1,21 +1,21 @@
function parseGephi(gephiJSON, options) {
function parseGephi(gephiJSON, optionsObj) {
var edges = []; var edges = [];
var nodes = []; var nodes = [];
this.options = {
var options = {
edges: { edges: {
inheritColor: true inheritColor: true
}, },
nodes: { nodes: {
allowedToMove: false,
fixed: false,
parseColor: false parseColor: false
} }
}; };
if (options !== undefined) { if (options !== undefined) {
this.options.nodes['allowedToMove'] = options.allowedToMove | false;
this.options.nodes['parseColor'] = options.parseColor | false;
this.options.edges['inheritColor'] = options.inheritColor | true;
options.nodes['fixed'] = optionsObj.fixed !== undefined ? options.fixed : false;
options.nodes['parseColor'] = optionsObj.parseColor !== undefined ? options.parseColor : false;
options.edges['inheritColor'] = optionsObj.inheritColor !== undefined ? options.inheritColor : true;
} }
var gEdges = gephiJSON.edges; var gEdges = gephiJSON.edges;
@ -30,7 +30,7 @@ function parseGephi(gephiJSON, options) {
// edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined;
// edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size;
edge['color'] = gEdge.color; edge['color'] = gEdge.color;
edge['inheritColor'] = edge['color'] !== undefined ? false : this.options.inheritColor;
edge['inheritColor'] = edge['color'] !== undefined ? false : options.inheritColor;
edges.push(edge); edges.push(edge);
} }
@ -39,18 +39,18 @@ function parseGephi(gephiJSON, options) {
var gNode = gNodes[i]; var gNode = gNodes[i];
node['id'] = gNode.id; node['id'] = gNode.id;
node['attributes'] = gNode.attributes; node['attributes'] = gNode.attributes;
node['title'] = gNode.title;
node['x'] = gNode.x; node['x'] = gNode.x;
node['y'] = gNode.y; node['y'] = gNode.y;
node['label'] = gNode.label; node['label'] = gNode.label;
if (this.options.nodes.parseColor === true) {
if (options.nodes.parseColor === true) {
node['color'] = gNode.color; node['color'] = gNode.color;
} }
else { else {
node['color'] = gNode.color !== undefined ? {background:gNode.color, border:gNode.color} : undefined; node['color'] = gNode.color !== undefined ? {background:gNode.color, border:gNode.color} : undefined;
} }
node['radius'] = gNode.size;
node['allowedToMoveX'] = this.options.nodes.allowedToMove;
node['allowedToMoveY'] = this.options.nodes.allowedToMove;
node['size'] = gNode.size;
node['fixed'] = options.nodes.fixed && gNode.x !== undefined && gNode.y !== undefined;
nodes.push(node); nodes.push(node);
} }

+ 1
- 1
lib/network/modules/EdgesHandler.js View File

@ -40,7 +40,7 @@ class EdgesHandler {
size: 14, // px size: 14, // px
face: 'arial', face: 'arial',
background: 'none', background: 'none',
strokeWidth: 0, // px
strokeWidth: 2, // px
strokeColor: '#ffffff', strokeColor: '#ffffff',
align:'horizontal' align:'horizontal'
}, },

+ 3
- 4
lib/network/modules/components/Edge.js View File

@ -396,16 +396,15 @@ class Edge {
else { else {
var x, y; var x, y;
var radius = this.options.selfReferenceSize; var radius = this.options.selfReferenceSize;
if (node1.width > node1.height) {
x = node1.x + node1.width * 0.5;
if (node1.shape.width > node1.shape.height) {
x = node1.x + node1.shape.width * 0.5;
y = node1.y - radius; y = node1.y - radius;
} }
else { else {
x = node1.x + radius; x = node1.x + radius;
y = node1.y - node1.height * 0.5;
y = node1.y - node1.shape.height * 0.5;
} }
point = this._pointOnCircle(x, y, radius, 0.125); point = this._pointOnCircle(x, y, radius, 0.125);
this.labelModule.draw(ctx, point.x, point.y, selected); this.labelModule.draw(ctx, point.x, point.y, selected);
} }
} }

Loading…
Cancel
Save