HT for Web Flow Manual

Index


Overview

The flow edge plug-in can adds a flow effect in ht.Shape and ht.Edge that supports internal flow elements or custom flow elements along the path, and does not introduce new classes, just extend some methods or styles in ht.Shape, ht.Edge and ht.graph.GraphView and are therefore very easy to use. To use this plug-in, simply introduce ht-flow.js files:

<script src="ht.js"></script> <!--Introduce ht.js file first-->
<script src="ht-flow.js"></script>

This plug-in expands some styles to control the flow effect in ht.Shape and ht.Edge class that users can operate these styles by ht.Shape#setStyle and ht.edge#setStyle is described as follows:

The API extended on ht.graph.GraphView is as follows:

As you can see from the above illustration, the time interval of all Data flows on the topology is the same, and if you need to create different effects of different Data flows, you can modify the flow.step style for the relevant Data.

Demo1: Comprehensive example

You can verify this plug-in by manipulating the following example:

The example above shows how to use the flow style, and you can view the implementation principle through source code.

Demo2: Bus route Map

You can drag the bus station to adjust the line. The bus station realized by ht.Node, the bus uses the flowing picture to display, because the bus station and the line are different nodes, in order to avoid the bus on the line is blocked by the bus station, uses two Shape to simulate the line and the bus:

Bus station node fixed on the busLane through setHost(busLane), and then fixed to busLanePath through setLayer(1) that can realize the effect that the bus flows in the line and the bus station.

In addition, drag and drop bus station will adjust busLanePath and busLane, so need to listen to the location of the bus station information changes, and then modify the line of points, because the site is adsorbed on the line, modify the line points need to call ht.Default.getInternal().setIsolating(true); to avoid the impact of bus stops and lines.

Demo3: Integration with other plug-ins

No need to do additional processing, in accordance with the original way to use the plug-ins' own API, the following example uses the EdgeType plug-in, automatic layout plug-in and Painter mechanism:

This example uses the global default style configuration:

<script type="text/javascript">
    htconfig = {
         Style: {
             'edge.color': "black",
             'flow': true,
             'edge.offset': 0,
             'flow.element.background': "rgb(41, 249, 47)",
             'flow.element.count': 1,
             'flow.count': 2,
             'flow.element.max': 10,
             'flow.element.shadow.visible': false
         }
     };
 </script>

The details of this syntactic structure can be referenced Theme Manual


Welcome to contact us service@hightopo.com