Skip to content

Commit 4878026

Browse files
Added group parameter in compute
1 parent 40aa734 commit 4878026

37 files changed

+113
-99
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ All of the following graph APIs accept a parameter named `compute` which is a ha
258258
}
259259
}
260260

261-
All curves in the `curves` array will contain the corresponding properties in addition to `index` and `item`; for instance in the example above each curve will have the `color` property.
261+
All curves in the `curves` array will contain the corresponding properties in addition to `index` and `item`; for instance in the example above each curve will have the `color` property. Each function in the `compute` hash receives two parameters `index` and `item`; where it makes sense it also receives a third parameter `group` containing a group index (for items that are clustered).
262262

263263
This feature is useful if the resulting graph will be rendered with a somewhat static template engine, such as Mustache, that needs to have all fields precomputed. More flexbile template engines, such as the one in Ractive, allow custom expressions to be evaluated in templates, so there will be generally no need for the `compute` parameter.
264264

@@ -581,7 +581,7 @@ Parameters:
581581
* `link_accessor`: a function that is applied to each datum inside each item in `data.links`.
582582
* `gutter` (optional, default 10): the space to leave between each bar
583583
* `rect_width` (optional, default 10): the widht of each bar
584-
* `compute` (optional): see the introduction.
584+
* `compute` (optional): see the introduction. Each function here has three parameters: `index`, `item` and `group`, where the third one represents the outer index in the `nodes` array.
585585

586586
The `nodes` is a list of lists of objects. Each list represent a level of the diagram; each element in a list is an object which contains at least an id for the links. Id's should be unique to avoid wrong associations.
587587

ROADMAP.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
* New chart: Waterfall
55
* New chart: Graph layout (not optimized)
66
* New chart: Tree
7+
* New chart: Sankey diagram
78
* Code snippets visible from the demo application
89

910
0.4
1011
===
1112

13+
* Coordinate changes
1214
* Cumulative versions of bar and line charts
1315
* New shape: Poincaré arc
1416
* New chart: Circos
1517
* Optimize Graph chart
16-
* Coordinate changes
18+
* Improve layout of trees and Sankey diagrams
1719

1820
0.5
1921
===

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "paths-js",
3-
"version": "0.2.13",
3+
"version": "0.2.14",
44
"main": "dist/amd",
55
"ignore": [
66
".gitignore",

dist/amd/ops.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
_ref = compute || {};
5555
for (key in _ref) {
5656
method = _ref[key];
57-
curve[key] = method(curve.index, curve.item);
57+
curve[key] = method(curve.index, curve.item, curve.group);
5858
}
5959
return curve;
6060
};

dist/amd/path.js

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/amd/sankey.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
return rects.push(O.enhance(compute, {
9696
curve: Rectangle(att),
9797
item: data.nodes[idg][idn],
98-
index: node_idx
98+
index: node_idx,
99+
group: idg
99100
}));
100101
});
101102
});

dist/global/paths.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ All of the following graph APIs accept a parameter named `compute` which is a ha
258258
}
259259
}
260260

261-
All curves in the `curves` array will contain the corresponding properties in addition to `index` and `item`; for instance in the example above each curve will have the `color` property.
261+
All curves in the `curves` array will contain the corresponding properties in addition to `index` and `item`; for instance in the example above each curve will have the `color` property. Each function in the `compute` hash receives two parameters `index` and `item`; where it makes sense it also receives a third parameter `group` containing a group index (for items that are clustered).
262262

263263
This feature is useful if the resulting graph will be rendered with a somewhat static template engine, such as Mustache, that needs to have all fields precomputed. More flexbile template engines, such as the one in Ractive, allow custom expressions to be evaluated in templates, so there will be generally no need for the `compute` parameter.
264264

@@ -581,7 +581,7 @@ Parameters:
581581
* `link_accessor`: a function that is applied to each datum inside each item in `data.links`.
582582
* `gutter` (optional, default 10): the space to leave between each bar
583583
* `rect_width` (optional, default 10): the widht of each bar
584-
* `compute` (optional): see the introduction.
584+
* `compute` (optional): see the introduction. Each function here has three parameters: `index`, `item` and `group`, where the third one represents the outer index in the `nodes` array.
585585

586586
The `nodes` is a list of lists of objects. Each list represent a level of the diagram; each element in a list is an object which contains at least an id for the links. Id's should be unique to avoid wrong associations.
587587

dist/node/bar.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/barnes_hut.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/bezier.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/connector.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/curved-rectangle.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/graph.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/line-chart-comp.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/linear.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/ops.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "paths-js",
3-
"version": "0.2.13",
3+
"version": "0.2.14",
44
"author": {
55
"name": "Andrea Ferretti"
66
},

dist/node/path.js

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/pie.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/polygon.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/radar.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/rectangle.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/sankey.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/sector.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/semi-regular-polygon.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/smooth-line.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/stock.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/tree.js

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node/tree_utils.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)