Skip to content

Commit

Permalink
fix(docs,render) paramterize shapeRadius; colorize based on labels
Browse files Browse the repository at this point in the history
  • Loading branch information
akollegger committed Jan 25, 2021
1 parent 3dd6a0d commit 945020b
Show file tree
Hide file tree
Showing 26 changed files with 324 additions and 232 deletions.
2 changes: 1 addition & 1 deletion docs/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
JEKYLL_GITHUB_TOKEN=c216031418ebc26e0adbb98143836a2f463e9518
JEKYLL_GITHUB_TOKEN=8e806530d81f40b4ac28a28c60ae825e44eff7a2
52 changes: 30 additions & 22 deletions docs/_data/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 121,
"line": 153,
"character": 17
}
],
Expand Down Expand Up @@ -469,7 +469,7 @@
},
"type": {
"type": "intrinsic",
"name": "string"
"name": "any"
}
},
{
Expand All @@ -480,7 +480,13 @@
"flags": {},
"type": {
"type": "reference",
"name": "D3GramDrawConfiguration"
"typeArguments": [
{
"type": "reference",
"name": "D3GramDrawConfiguration"
}
],
"name": "Partial"
},
"defaultValue": "..."
}
Expand All @@ -496,7 +502,7 @@
"children": [
{
"id": 37,
"name": "links",
"name": "linkSelection",
"kind": 1024,
"kindString": "Property",
"flags": {},
Expand All @@ -522,12 +528,11 @@
}
],
"name": "Selection"
},
"defaultValue": "..."
}
},
{
"id": 36,
"name": "nodes",
"name": "nodeSelection",
"kind": 1024,
"kindString": "Property",
"flags": {},
Expand All @@ -553,8 +558,7 @@
}
],
"name": "Selection"
},
"defaultValue": "..."
}
}
],
"groups": [
Expand Down Expand Up @@ -583,7 +587,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 89,
"line": 117,
"character": 22
}
],
Expand Down Expand Up @@ -625,7 +629,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 105,
"line": 133,
"character": 22
}
],
Expand Down Expand Up @@ -2791,7 +2795,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 121,
"line": 153,
"character": 17
}
],
Expand Down Expand Up @@ -2830,7 +2834,7 @@
},
"type": {
"type": "intrinsic",
"name": "string"
"name": "any"
}
},
{
Expand All @@ -2841,7 +2845,13 @@
"flags": {},
"type": {
"type": "reference",
"name": "D3GramDrawConfiguration"
"typeArguments": [
{
"type": "reference",
"name": "D3GramDrawConfiguration"
}
],
"name": "Partial"
},
"defaultValue": "..."
}
Expand All @@ -2857,7 +2867,7 @@
"children": [
{
"id": 182,
"name": "links",
"name": "linkSelection",
"kind": 1024,
"kindString": "Property",
"flags": {},
Expand All @@ -2883,12 +2893,11 @@
}
],
"name": "Selection"
},
"defaultValue": "..."
}
},
{
"id": 181,
"name": "nodes",
"name": "nodeSelection",
"kind": 1024,
"kindString": "Property",
"flags": {},
Expand All @@ -2914,8 +2923,7 @@
}
],
"name": "Selection"
},
"defaultValue": "..."
}
}
],
"groups": [
Expand Down Expand Up @@ -3424,7 +3432,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 89,
"line": 117,
"character": 22
}
],
Expand Down Expand Up @@ -3466,7 +3474,7 @@
"sources": [
{
"fileName": "src/d3-gram-renderer.ts",
"line": 105,
"line": 133,
"character": 22
}
],
Expand Down
6 changes: 3 additions & 3 deletions docs/_layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

<svg class="absolute top-0 right-0" width="800" height="400" id="graph"></svg>
<div class="container mx-auto">
<h1 class="font-serif text-white text-6xl">gram</h1>
<h2 class="font-mono text-white text-3xl mb-16 mt-2">(text)-->(data)</h2>
<p class="text-white mb-0">a textual format for data graphs</p>
<h1 class="font-serif text-white text-6xl">d3-gram</h1>
<h2 class="font-mono text-white text-3xl mb-16 mt-2">(gram)-->(d3)</h2>
<p class="text-white mb-0">d3.js visualization of gram graphs</p>
<pre class="bg-white rounded pl-2 mt-8 mb-2 w-full">(a:A)-->(b:B)<--(c:C)-->(a), (c)-->(d), (c)-->(e)</pre>
</div>
</div>
Expand Down
17 changes: 9 additions & 8 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ ready to be used in a `d3-force` simulation.

``` TypeScript
import * as d3 from "d3";
import {d3Gram} from 'd3-gram';
import {parse, layout, draw, moveNodes, moveLinks} from 'd3-gram';

d3.text("https://raw.githubusercontent.com/gram-data/d3-gram/master/public/miserables.gram").then( gramSource => {

let graph = d3Gram(gramSource);
let graph = parse(gramSource);

let simulation = d3.forceSimulation()
.force("charge", d3.forceManyBody())
.force("center", d3.forceCenter(300,200)) // preferably calculate the center of the svg
.force('collision', d3.forceCollide());
let simulation = layout(graph);

simulation.nodes(graph.nodes);
simulation.force("link", d3.forceLink(graph.links).id((d:any) => d.id))
const {nodeSelection, linkSelection} = draw(graph, "svg");

simulation.on("tick", () => {
moveNodes(nodeSelection);
moveLinks(linkSelection);
});
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ All numbers are in scale-free units.

Scene height.

Defined in: [src/d3-gram-layout.ts:26](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L26)
Defined in: [src/d3-gram-layout.ts:26](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L26)

___

Expand All @@ -41,7 +41,7 @@ ___

How long to run the simulation.

Defined in: [src/d3-gram-layout.ts:30](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L30)
Defined in: [src/d3-gram-layout.ts:30](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L30)

___

Expand All @@ -51,4 +51,4 @@ ___

Scene width.

Defined in: [src/d3-gram-layout.ts:22](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L22)
Defined in: [src/d3-gram-layout.ts:22](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L22)
6 changes: 3 additions & 3 deletions docs/api/interfaces/d3_gram_types.gramgraphdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ layout: api

**links**: [*GramLinkDatum*](d3_gram_types.gramlinkdatum.md)[]

Defined in: [src/d3-gram-types.ts:57](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L57)
Defined in: [src/d3-gram-types.ts:57](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L57)

___

### nodes

**nodes**: [*GramNodeDatum*](d3_gram_types.gramnodedatum.md)[]

Defined in: [src/d3-gram-types.ts:56](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L56)
Defined in: [src/d3-gram-types.ts:56](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L56)

___

### paths

**paths**: [*GramPathDatum*](d3_gram_types.grampathdatum.md)[]

Defined in: [src/d3-gram-types.ts:58](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L58)
Defined in: [src/d3-gram-types.ts:58](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L58)
6 changes: 3 additions & 3 deletions docs/api/interfaces/d3_gram_types.gramlinkdatum.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ layout: api

**id**: *string*

Defined in: [src/d3-gram-types.ts:30](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L30)
Defined in: [src/d3-gram-types.ts:30](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L30)

___

Expand All @@ -50,15 +50,15 @@ ___

`Optional` **labels**: *undefined* | *string*[]

Defined in: [src/d3-gram-types.ts:31](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L31)
Defined in: [src/d3-gram-types.ts:31](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L31)

___

### record

**record**: [*PathDatumRecord*](../modules/d3_gram_types.md#pathdatumrecord)

Defined in: [src/d3-gram-types.ts:32](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L32)
Defined in: [src/d3-gram-types.ts:32](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L32)

___

Expand Down
6 changes: 3 additions & 3 deletions docs/api/interfaces/d3_gram_types.gramnodedatum.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ___

**id**: *string*

Defined in: [src/d3-gram-types.ts:8](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L8)
Defined in: [src/d3-gram-types.ts:8](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L8)

___

Expand All @@ -74,15 +74,15 @@ ___

**labels**: *string*[]

Defined in: [src/d3-gram-types.ts:9](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L9)
Defined in: [src/d3-gram-types.ts:9](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L9)

___

### record

**record**: [*PathDatumRecord*](../modules/d3_gram_types.md#pathdatumrecord)

Defined in: [src/d3-gram-types.ts:10](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L10)
Defined in: [src/d3-gram-types.ts:10](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L10)

___

Expand Down
2 changes: 1 addition & 1 deletion docs/api/interfaces/d3_gram_types.grampathdatum.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ layout: api

**links**: [*GramLinkDatum*](d3_gram_types.gramlinkdatum.md)[]

Defined in: [src/d3-gram-types.ts:52](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L52)
Defined in: [src/d3-gram-types.ts:52](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L52)
6 changes: 3 additions & 3 deletions docs/api/interfaces/index.d3gramlayoutconfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ All numbers are in scale-free units.

Scene height.

Defined in: [src/d3-gram-layout.ts:26](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L26)
Defined in: [src/d3-gram-layout.ts:26](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L26)

___

Expand All @@ -41,7 +41,7 @@ ___

How long to run the simulation.

Defined in: [src/d3-gram-layout.ts:30](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L30)
Defined in: [src/d3-gram-layout.ts:30](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L30)

___

Expand All @@ -51,4 +51,4 @@ ___

Scene width.

Defined in: [src/d3-gram-layout.ts:22](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-layout.ts#L22)
Defined in: [src/d3-gram-layout.ts:22](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-layout.ts#L22)
6 changes: 3 additions & 3 deletions docs/api/interfaces/index.gramgraphdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ layout: api

**links**: [*GramLinkDatum*](d3_gram_types.gramlinkdatum.md)[]

Defined in: [src/d3-gram-types.ts:57](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L57)
Defined in: [src/d3-gram-types.ts:57](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L57)

___

### nodes

**nodes**: [*GramNodeDatum*](d3_gram_types.gramnodedatum.md)[]

Defined in: [src/d3-gram-types.ts:56](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L56)
Defined in: [src/d3-gram-types.ts:56](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L56)

___

### paths

**paths**: [*GramPathDatum*](d3_gram_types.grampathdatum.md)[]

Defined in: [src/d3-gram-types.ts:58](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L58)
Defined in: [src/d3-gram-types.ts:58](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L58)
6 changes: 3 additions & 3 deletions docs/api/interfaces/index.gramlinkdatum.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ layout: api

**id**: *string*

Defined in: [src/d3-gram-types.ts:30](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L30)
Defined in: [src/d3-gram-types.ts:30](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L30)

___

Expand All @@ -50,15 +50,15 @@ ___

`Optional` **labels**: *undefined* | *string*[]

Defined in: [src/d3-gram-types.ts:31](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L31)
Defined in: [src/d3-gram-types.ts:31](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L31)

___

### record

**record**: [*PathDatumRecord*](../modules/d3_gram_types.md#pathdatumrecord)

Defined in: [src/d3-gram-types.ts:32](https://github.com/gram-data/d3-gram/blob/b65614d/src/d3-gram-types.ts#L32)
Defined in: [src/d3-gram-types.ts:32](https://github.com/gram-data/d3-gram/blob/3dd6a0d/src/d3-gram-types.ts#L32)

___

Expand Down

0 comments on commit 945020b

Please sign in to comment.