<commit_before># neo4jd3.js

[Neo4j](https://github.com/neo4j) graph visualization using [D3.js](https://github.com/d3/d3).

![neo3jd3.js](https://eisman.github.io/neo4jd3/img/neo4jd3.jpg?v=2)

## Features

* Neo4j's JSON graph format.
* Force simulation.
* Info panel that shows nodes and relationships information on hover.
* Double click callbacks.
* Custom node colors by node type.
* [Font Awesome](http://fontawesome.io/) icon nodes.
* Relationship auto-orientation.
* Zoom, pan, auto fit.
* Compatible with D3.js v4.

## Running

Clone the repository, install all dependencies, build and serve the project:

```bash
> git clone https://github.com/eisman/neo4jd3.git
> npm install
> gulp
```

Open `http://localhost:8080` in your favourite browser.

## Documentation

```javascript
var neo4jd3 = new Neo4jd3('.selector', options);
```

### Options

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| **dataUrl** | *string* | URL of the endpoint that serves the graph in JSON format. |
| **icons** | *object* | Map node labels to [Font Awesome icons](http://fontawesome.io/icons).<br>Example:<br>`{`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Address': 'home',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'BirthDate': 'calendar-o',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'EncryptedPassword': '<PASSWORD>',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'NameSignature': 'pencil',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Phone': 'phone',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Player': 'user',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'SecurityChallengeAnswer': 'comment'`<br>`}`. |
| **infoPanel** | *boolean* | Show the information panel: `true`, `false`. Default: `true`. |
| **minCollision** | *int* | Minimum distance between nodes. Default: 2 * *nodeRadius*. |
| **nodeRadius** | *int* | Radius of nodes. Default: 25. |
| **onNodeDoubleClick** | *function* | Callback function to be executed when the user double clicks a node. |
| **onRelationshipDoubleClick** | *function* | Callback function to be executed when the user double clicks a relationship. |
| **zoomFit** | *boolean* | Adjust the graph to the container once it has been loaded: `true`, `false`. Default: `false`. |

### Example

Live example @ [https://eisman.github.io/neo4jd3/](https://eisman.github.io/neo4jd3/)

```javascript
var neo4jd3 = new Neo4jd3('#neo4jd3', {
    dataUrl: 'json/data.json',
    icons: {
        'Address': 'home',
        'Api': 'gear',
        'BirthDate': 'birthday-cake',
        'Cookie': 'paw',
        'CreditCard': 'credit-card',
        'Device': 'laptop',
        'Email': 'at',
        'Git': 'git',
        'Github': 'github',
        'icons': 'font-awesome',
        'Ip': 'map-marker',
        'Issues': 'exclamation-circle',
        'Language': 'language',
        'Options': 'sliders',
        'Password': '<PASSWORD>',
        'Phone': 'phone',
        'Project': 'folder-open',
        'SecurityChallengeAnswer': 'commenting',
        'User': 'user',
        'zoomFit': 'arrows-alt',
        'zoomIn': 'search-plus',
        'zoomOut': 'search-minus'
    },
    minCollision: 60,
    nodeRadius: 25,
    onNodeDoubleClick: function(node) {
        console.log('double click on node: ' + JSON.stringify(node));
    },
    onRelationshipDoubleClick: function(relationship) {
        console.log('double click on relationship: ' + JSON.stringify(relationship));
    },
    zoomFit: true
});
```

## What's coming?

* More than one relationship between two nodes.
* JavaScript API.

## Copyright and license

Code and documentation copyright 2016 the author. Code released under the [MIT license](LICENSE). Docs released under [Creative Commons](docs/LICENSE).<commit_msg>Update project info<commit_after># neo4jd3.js

[Neo4j](https://github.com/neo4j) graph visualization using [D3.js](https://github.com/d3/d3).

![neo3jd3.js](https://eisman.github.io/neo4jd3/img/neo4jd3.jpg?v=2)

## Features

* Neo4j's JSON graph format.
* Force simulation.
* Info panel that shows nodes and relationships information on hover.
* Double click callbacks.
* Custom node colors by node type.
* Text or [Font Awesome](http://fontawesome.io/) icon nodes.
* Relationship auto-orientation.
* Zoom, pan, auto fit.
* Compatible with D3.js v4.

## Running

Clone the repository, install all dependencies, build and serve the project:

```bash
> git clone https://github.com/eisman/neo4jd3.git
> npm install
> gulp
```

Open `http://localhost:8080` in your favourite browser.

## Documentation

```javascript
var neo4jd3 = new Neo4jd3('.selector', options);
```

### Options

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| **dataUrl** | *string* | URL of the endpoint that serves the graph in JSON format. |
| **icons** | *object* | Map node labels to [Font Awesome icons](http://fontawesome.io/icons).<br>Example:<br>`{`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Address': 'home',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'BirthDate': 'calendar-o',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Password': '<PASSWORD>',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'Phone': 'phone',`<br>&nbsp;&nbsp;&nbsp;&nbsp;`'User': 'user'`<br>`}`. |
| **infoPanel** | *boolean* | Show the information panel: `true`, `false`. Default: `true`. |
| **minCollision** | *int* | Minimum distance between nodes. Default: 2 * *nodeRadius*. |
| **nodeRadius** | *int* | Radius of nodes. Default: 25. |
| **onNodeDoubleClick** | *function* | Callback function to be executed when the user double clicks a node. |
| **onRelationshipDoubleClick** | *function* | Callback function to be executed when the user double clicks a relationship. |
| **zoomFit** | *boolean* | Adjust the graph to the container once it has been loaded: `true`, `false`. Default: `false`. |

### Example

Live example @ [https://eisman.github.io/neo4jd3/](https://eisman.github.io/neo4jd3/)

```javascript
var neo4jd3 = new Neo4jd3('#neo4jd3', {
    dataUrl: 'json/data.json',
    icons: {
        'Address': 'home',
        'Api': 'gear',
        'BirthDate': 'birthday-cake',
        'Cookie': 'paw',
        'CreditCard': 'credit-card',
        'Device': 'laptop',
        'Email': 'at',
        'Git': 'git',
        'Github': 'github',
        'icons': 'font-awesome',
        'Ip': 'map-marker',
        'Issues': 'exclamation-circle',
        'Language': 'language',
        'Options': 'sliders',
        'Password': '<PASSWORD>',
        'Phone': 'phone',
        'Project': 'folder-open',
        'SecurityChallengeAnswer': 'commenting',
        'User': 'user',
        'zoomFit': 'arrows-alt',
        'zoomIn': 'search-plus',
        'zoomOut': 'search-minus'
    },
    minCollision: 60,
    nodeRadius: 25,
    onNodeDoubleClick: function(node) {
        console.log('double click on node: ' + JSON.stringify(node));
    },
    onRelationshipDoubleClick: function(relationship) {
        console.log('double click on relationship: ' + JSON.stringify(relationship));
    },
    zoomFit: true
});
```

## What's coming?

* More than one relationship between two nodes.
* JavaScript API.
* Testing.

## Copyright and license

Code and documentation copyright 2016 the author. Code released under the [MIT license](LICENSE). Docs released under [Creative Commons](docs/LICENSE).
{'fraction_non_alphanumeric': 0.18398541579021174, 'fraction_numerical': 0.013462347496844763, 'mean_word_length': 3.761014686248331, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '584247', 'n_tokens_mistral': 2367, 'n_tokens_neox': 2239, 'n_words': 586}