<td>If two datapoints of a barchart overlap, they are drawn over eachother by default. If sideBySide is set to true, they will be drawn side by side.
<td>If two datapoints of a barchart overlap, they are drawn over eachother by default. If sideBySide is set to true, they will be drawn side by side, within the same width as a single bar..
See <ahref="../../examples/graph2d/10_barsSideBySide.html">example 10</a> for more information.
See <ahref="../../examples/graph2d/10_barsSideBySide.html">example 10</a> for more information.
When using groups, see <ahref="../../examples/graph2d/11_barsSideBySideGroups.html">example 11</a>.
When using groups, see <ahref="../../examples/graph2d/11_barsSideBySideGroups.html">example 11</a>.
<td>The minimum width of the bars in pixels: by default the bars get smaller while zooming out to prevent overlap, this value is the minimum width of the bar. Default behavior (when minWidth is not set) is 10% of the bar width.</td>
<td>Exactly the same as the to object but with an arrowhead at the from node of the edge.</td>
<td>Exactly the same as the to object but with an arrowhead at the from node of the edge.</td>
</tr>
</tr>
<tr>
<tdclass="indent">arrowStrikethrough</td>
<td>Boolean</td>
<td><code>true</code></td>
<td>When false, the edge stops at the arrow. This can be useful if you have thick lines and you want the arrow to end in a point. Middle arrows are not affected by this.</td>
<trclass='toggle collapsible'onclick="toggleTable('optionTable','hierarchical', this);"><td><spanparent="repulsion"class="right-caret"></span> hierarchical</td><td>Object or Boolean</td><td><code>Object</code></td><td>When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('optionTable','hierarchical', this);"><td><spanparent="repulsion"class="right-caret"></span> hierarchical</td><td>Object or Boolean</td><td><code>Object</code></td><td>When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.enabled</td><td>Boolean</td><td><code>false</code></td><td>Toggle the usage of the hierarchical layout system. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.enabled</td><td>Boolean</td><td><code>false</code></td><td>Toggle the usage of the hierarchical layout system. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.levelSeparation</td><td>Number</td><td><code>150</code></td><td>The distance between the different levels.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.levelSeparation</td><td>Number</td><td><code>150</code></td><td>The distance between the different levels.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.nodeSpacing</td><td>Number</td><td><code>100</code></td><td>Minimum distance between nodes on the free axis. This is only for the initial layout. If you enable physics, the node distance there will be the effective node distance.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.treeSpacing</td><td>Number</td><td><code>200</code></td><td>Distance between different trees (independent networks). This is only for the initial layout. If you enable physics, the repulsion model will denote the distance between the trees.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.blockShifting</td><td>Boolean</td><td><code>true</code></td><td>Method for reducing whitespace. Can be used alone or together with edge minimization. Each node will check for whitespace and will shift
it's branch along with it for as far as it can, respecting the nodeSpacing on any level. This is mainly for the initial layout. If you enable physics, they layout will be determined by the physics. This will greatly speed up the stabilization time though!</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.edgeMinimization</td><td>Boolean</td><td><code>true</code></td><td>Method for reducing whitespace. Can be used alone or together with block shifting. Enabling block shifting will usually speed up the layout process.
Each node will try to move along its free axis to reduce the total length of it's edges. This is mainly for the initial layout. If you enable physics, they layout will be determined by the physics. This will greatly speed up the stabilization time though!</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.direction</td><td>String</td><td><code>'UD'</code></td><td>The direction of the hierarchical layout. The available options are: <code>UD, DU, LR, RL</code>. To simplify: up-down, down-up, left-right, right-left.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.direction</td><td>String</td><td><code>'UD'</code></td><td>The direction of the hierarchical layout. The available options are: <code>UD, DU, LR, RL</code>. To simplify: up-down, down-up, left-right, right-left.</td></tr>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.sortMethod</td><td>String</td><td><code>'hubsize'</code></td><td>The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: <code>hubsize, directed</code>. <br><br>
<trparent="hierarchical"class="hidden"><tdclass="indent">hierarchical.sortMethod</td><td>String</td><td><code>'hubsize'</code></td><td>The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: <code>hubsize, directed</code>. <br><br>
Hubsize takes the nodes with the most edges and puts them at the top. From that the rest of the hierarchy is evaluated. <br><br>
Hubsize takes the nodes with the most edges and puts them at the top. From that the rest of the hierarchy is evaluated. <br><br>
This example shows a user-defined hierarchical layout. If the user defines levels for nodes but does not do so for all nodes, an alert will show up and hierarchical layout will be disabled. Either all or none can be defined.
This example shows a user-defined hierarchical layout. If the user defines levels for nodes but does not do so for
all nodes, an alert will show up and hierarchical layout will be disabled. Either all or none can be defined.
If the smooth curves appear to be inverted, the direction of the edge is not in the same direction as the network.
If the smooth curves appear to be inverted, the direction of the edge is not in the same direction as the network.
</div>
</div>
<p>
<p>
<inputtype="button"id="btn-UD"value="Up-Down">
<inputtype="button"id="btn-DU"value="Down-Up">
<inputtype="button"id="btn-LR"value="Left-Right">
<inputtype="button"id="btn-RL"value="Right-Left">
<inputtype="hidden"id='direction'value="UD">
<inputtype="button"id="btn-UD"value="Up-Down">
<inputtype="button"id="btn-DU"value="Down-Up">
<inputtype="button"id="btn-LR"value="Left-Right">
<inputtype="button"id="btn-RL"value="Right-Left">
<inputtype="hidden"id='direction'value="UD">
</p>
</p>
<divid="mynetwork"></div>
<divid="mynetwork"></div>
@ -123,22 +128,22 @@
<scriptlanguage="JavaScript">
<scriptlanguage="JavaScript">
var directionInput = document.getElementById("direction");
var directionInput = document.getElementById("direction");
<td>Minimum distance between nodes on the free axis.</td>
</tr>
<tr>
<td><code>treeSpacing</code></td>
<td>Distance between different trees (independent networks).</td>
</tr>
<tr>
<td><code>blockShifting</code></td>
<td>Method for reducing whitespace. Can be used alone or together with edge minimization. Each node will check for whitespace and will shift
it's branch along with it for as far as it can, respecting the nodeSpacing on any level.</td>
</tr>
<tr>
<td><code>edgeMinimization</code></td>
<td>Method for reducing whitespace. Can be used alone or together with block shifting. Enabling block shifting will usually speed up the layout process.
Each node will try to move along its free axis to reduce the total length of it's edges.</td>
</tr>
</table>
<br/><br/>
Play with the settings below the network and see how the layout changes!
<divid="network"></div>
<script>
var data = {
nodes: nodes,
edges: edges
};
// create a network
var container = document.getElementById('network');
var options = {
layout: {
hierarchical: {
direction: "UD",
sortMethod: "directed"
}
},
interaction: {dragNodes :false},
physics: {
enabled: false
},
configure: {
filter: function (option, path) {
if (path.indexOf('hierarchical') !== -1) {
return true;
}
return false;
},
showButton:false
}
};
var network = new vis.Network(container, data, options);
You can also supply a custom filter function or filter string. You can press the generate options button below to have an options object printed. You can then use
You can also supply a custom filter function or filter string. You can press the generate options button below to have an options object printed. You can then use
this in the network.
this in the network.
</p>
</p>
<p><b>Note:</b> The configurator is recreated in the dom tree on input change. This may cause undesired scrolls in your application. In order to avoid this, explicitly set the height of the configurator (see this example's source code).