Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

Commit

Permalink
Data processors (except Circle)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexei Zverev committed Oct 4, 2016
1 parent c111c87 commit 158e83b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
3 changes: 1 addition & 2 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ dependencies/binding
simplify binding: merge the 2nd section into the 1st
why it inherits nx.Observable

Data processors: 003-05 (describe built-in ones)
Data processors: 003-05 (circle DP left)
Layouts - 003-06 (describe the built-in ones)
mvvm - 006-05
extended nodes s006-04: example from PCE-OF

create codepens for articles in 003
Expand Down
Binary file added images/tutorial-003-05/force-dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tutorial-003-05/quick-dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 24 additions & 13 deletions tutorials/tutorial-003-05.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Data Processors
Data processor (hereinafter DP) is a procedure that processes topology data in one or another way. The way we usually use them in NeXt is to assign special positioning to the nodes, or modify the input information so that its representation would match our purposes.
Data processor (DP) is a class that processes topology data in one or another way. The way we usually use them in NeXt is to assign special positioning to the nodes, or modify the input information so that its representation would match our purposes.

In other words, when you use a DP over a chunk of topology data, it modifies something in it, depending on the purpose you do that.

## Built-in DPs

Before you get the detailed description of each data processor, let us give you more information on where to find the code:
Before you get the detailed description of each data processor, let us give you more information on where you can find the code:

* You can normally find the DP classes at the following path: ```/src/js/graphic/data/processor```
* If you navigate to the ```/src/js/graphic/data/dataprocessor.js```, you'll find the place where all the DPs are included as static members.
* If you navigate to the ```/src/js/graphic/data/dataprocessor.js```, you'll find the place where all the DPs get included as static members.

Now let's look over each DP.

### Force
**Force** data processor create a fundament for autolayout. Essentially what it does is it spreads out the nodes automatically so they would as equally distant as possible. That makes a beautiful picture without you assigning the x/y or altitude/latitude positioning to the nodes.
**Force** data processor create a fundament for autolayout. Essentially what it does is it spreads out the nodes automatically so they would as equally distant as possible. That makes a beautiful picture without you assigning the x/y positioning to the nodes.

#### Force: Usage
To use Force DP you need to set the ```dataProcessor``` prop in topology configuration to "force".
In order to use Force DP, you will need to set the ```dataProcessor``` property in topology configuration to "force".

```JavaScript
nx.define("Topo", nx.graphic.Topology, {
Expand All @@ -27,19 +29,28 @@ nx.define("Topo", nx.graphic.Topology, {
});
```

### NeXt Force
TBD
#### Force: demo

![](../images/tutorial-003-05/force-dp.png)

"Force" data processor on [Codepen](http://codepen.io/NEXTSUPPORT/pen/EgbLGg)

### Quick
TBD
Quick data processor essentially assigns random [x;y] position to each node. Compared to the "Force" DP, there's no logic that spreads out the nodes or make up a beautiful shape of the topology. Just random position.

### Circle
TBD
#### Quick: demo

![](../images/tutorial-003-05/quick-dp.png)

"Quick" data processor on [Codepen](http://codepen.io/NEXTSUPPORT/pen/OROkgv)

### Hierarchical nodeset?
### Circle
TBD

## Create Your DP
The machanism of creation data processors does not currently exist. Stick to use built-in ones.
The machanism of creation data processors does not currently exist. Hold on to using the built-in ones.

## What's Next?
The next tutorial will teach you to use layouts.

## What's Next?
[Read NEXT](./tutorial-003-06.md)

0 comments on commit 158e83b

Please sign in to comment.