@plotdb/chart 0.0.3 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/build +11 -5
  3. package/dist/index.css +8 -0
  4. package/dist/index.js +607 -0
  5. package/dist/index.min.css +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/package.json +12 -9
  8. package/src/{chart.ls → index.ls} +0 -0
  9. package/src/{chart.styl → index.styl} +0 -0
  10. package/web/src/pug/base.pug +1 -0
  11. package/web/src/pug/block/axis/0.0.1/index.ls +1 -7
  12. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +1 -5
  13. package/web/src/pug/block/bar/0.0.1/index.ls +1 -5
  14. package/web/src/pug/block/bar-list/0.0.1/index.ls +1 -5
  15. package/web/src/pug/block/bar-race/0.0.1/index.ls +1 -5
  16. package/web/src/pug/block/base/0.0.1/index.ls +63 -64
  17. package/web/src/pug/block/blank/0.0.1/index.ls +1 -5
  18. package/web/src/pug/block/bubble/0.0.1/index.ls +4 -6
  19. package/web/src/pug/block/bubble/0.0.1/index.pug +14 -0
  20. package/web/src/pug/block/curve-bar/0.0.1/index.ls +1 -5
  21. package/web/src/pug/block/dumbbell/0.0.1/index.ls +1 -5
  22. package/web/src/pug/block/empty/0.0.1/index.ls +25 -24
  23. package/web/src/pug/block/gauge/0.0.1/index.ls +1 -5
  24. package/web/src/pug/block/line/0.0.1/index.ls +1 -6
  25. package/web/src/pug/block/number/0.0.1/index.ls +1 -5
  26. package/web/src/pug/block/percent-list/0.0.1/index.ls +1 -7
  27. package/web/src/pug/block/pie/0.0.1/index.ls +1 -5
  28. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +1 -5
  29. package/web/src/pug/block/radar/0.0.1/index.ls +1 -5
  30. package/web/src/pug/block/scatter/0.0.1/index.ls +1 -5
  31. package/web/src/pug/block/sheet/0.0.1/index.ls +1 -5
  32. package/web/src/pug/block/table/0.0.1/index.ls +1 -5
  33. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +1 -5
  34. package/web/src/pug/block/taiwantown/0.0.1/index.ls +1 -5
  35. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +1 -5
  36. package/web/src/pug/block/treemap/0.0.1/index.ls +1 -5
  37. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +1 -5
  38. package/web/src/pug/block/wordcloud/0.0.1/index.ls +1 -5
  39. package/web/src/pug/block/worldmap/0.0.1/index.ls +1 -5
  40. package/web/src/styl/index.styl +6 -0
  41. package/web/static/block/axis/0.0.1/index.html +68 -73
  42. package/web/static/block/axis-bubble/0.0.1/index.html +205 -210
  43. package/web/static/block/bar/0.0.1/index.html +484 -489
  44. package/web/static/block/bar-list/0.0.1/index.html +188 -193
  45. package/web/static/block/bar-race/0.0.1/index.html +155 -160
  46. package/web/static/block/base/0.0.1/index.html +2 -2
  47. package/web/static/block/blank/0.0.1/index.html +35 -40
  48. package/web/static/block/bubble/0.0.1/index.html +377 -357
  49. package/web/static/block/curve-bar/0.0.1/index.html +126 -131
  50. package/web/static/block/dumbbell/0.0.1/index.html +160 -165
  51. package/web/static/block/empty/0.0.1/index.html +2 -2
  52. package/web/static/block/gauge/0.0.1/index.html +116 -121
  53. package/web/static/block/line/0.0.1/index.html +502 -507
  54. package/web/static/block/number/0.0.1/index.html +123 -128
  55. package/web/static/block/percent-list/0.0.1/index.html +263 -268
  56. package/web/static/block/pie/0.0.1/index.html +241 -246
  57. package/web/static/block/pie-bubble/0.0.1/index.html +295 -300
  58. package/web/static/block/radar/0.0.1/index.html +137 -142
  59. package/web/static/block/scatter/0.0.1/index.html +207 -212
  60. package/web/static/block/sheet/0.0.1/index.html +93 -98
  61. package/web/static/block/table/0.0.1/index.html +64 -70
  62. package/web/static/block/taiwancounty/0.0.1/index.html +180 -185
  63. package/web/static/block/taiwantown/0.0.1/index.html +104 -109
  64. package/web/static/block/taiwanvillage/0.0.1/index.html +114 -119
  65. package/web/static/block/treemap/0.0.1/index.html +296 -301
  66. package/web/static/block/voronoi-treemap/0.0.1/index.html +311 -316
  67. package/web/static/block/wordcloud/0.0.1/index.html +82 -87
  68. package/web/static/block/worldmap/0.0.1/index.html +186 -191
  69. package/web/static/css/index.css +6 -0
  70. package/web/static/css/index.min.css +1 -0
  71. package/web/static/index.html +1 -1
@@ -26,289 +26,284 @@
26
26
  justify-content: start;
27
27
  align-items: start;
28
28
  }
29
- </style><script type="@plotdb/block">(function(it){
30
- return it();
31
- })(function(){
32
- var blockFactory, mod;
33
- blockFactory = {
34
- pkg: {
35
- name: 'percent-list',
36
- version: '0.0.1',
37
- extend: {
38
- name: "base",
39
- version: "0.0.1"
40
- },
41
- dependencies: [],
42
- i18n: {
43
- "zh-TW": {
44
- "other": "其它"
45
- }
46
- }
29
+ </style><script type="@plotdb/block">var mod;
30
+ module.exports = {
31
+ pkg: {
32
+ name: 'percent-list',
33
+ version: '0.0.1',
34
+ extend: {
35
+ name: "base",
36
+ version: "0.0.1"
47
37
  },
48
- init: function(arg$){
49
- var root, context, pubsub, t;
50
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub, t = arg$.t;
51
- return pubsub.fire('init', {
52
- mod: mod({
53
- context: context,
54
- t: t
55
- })
56
- });
38
+ dependencies: [],
39
+ i18n: {
40
+ "zh-TW": {
41
+ "other": "其它"
42
+ }
57
43
  }
58
- };
59
- mod = function(arg$){
60
- var context, t, chart, d3, wrapSvgText, debounce;
61
- context = arg$.context, t = arg$.t;
62
- chart = context.chart, d3 = context.d3, wrapSvgText = context.wrapSvgText, debounce = context.debounce;
63
- return {
64
- sample: function(){
65
- return {
66
- raw: ["Bachchan Pandey", "The Good Maharaja", "Ramprasad Ki Tehrvi", "Madam Chief Minister", "Satya Sai Baba", "Lahore Confidential", "Sandeep Aur Pinky Faraar", "Silence... Can You Hear It?", "Hum Bhi Akele Tum Bhi Akele", "Radhe", "Shaadisthan", "Chandigarh Kare Aashiqui", "Gangubai Kathiawadi", "Attack", "The Battle of Bhima Koregaon", "Tadap", "Looop Lapeta"].map(function(val){
67
- return {
68
- val: Math.random(),
69
- name: val
70
- };
71
- }),
72
- binding: {
73
- name: {
74
- key: 'name'
75
- },
76
- value: {
77
- key: 'val'
78
- }
44
+ },
45
+ init: function(arg$){
46
+ var root, context, pubsub, t;
47
+ root = arg$.root, context = arg$.context, pubsub = arg$.pubsub, t = arg$.t;
48
+ return pubsub.fire('init', {
49
+ mod: mod({
50
+ context: context,
51
+ t: t
52
+ })
53
+ });
54
+ }
55
+ };
56
+ mod = function(arg$){
57
+ var context, t, chart, d3, wrapSvgText, debounce;
58
+ context = arg$.context, t = arg$.t;
59
+ chart = context.chart, d3 = context.d3, wrapSvgText = context.wrapSvgText, debounce = context.debounce;
60
+ return {
61
+ sample: function(){
62
+ return {
63
+ raw: ["Bachchan Pandey", "The Good Maharaja", "Ramprasad Ki Tehrvi", "Madam Chief Minister", "Satya Sai Baba", "Lahore Confidential", "Sandeep Aur Pinky Faraar", "Silence... Can You Hear It?", "Hum Bhi Akele Tum Bhi Akele", "Radhe", "Shaadisthan", "Chandigarh Kare Aashiqui", "Gangubai Kathiawadi", "Attack", "The Battle of Bhima Koregaon", "Tadap", "Looop Lapeta"].map(function(val){
64
+ return {
65
+ val: Math.random(),
66
+ name: val
67
+ };
68
+ }),
69
+ binding: {
70
+ name: {
71
+ key: 'name'
72
+ },
73
+ value: {
74
+ key: 'val'
79
75
  }
80
- };
81
- },
82
- config: {},
83
- dimension: {
84
- value: {
85
- type: 'R',
86
- name: "value",
87
- priority: 20
88
- },
89
- name: {
90
- type: 'N',
91
- name: "name",
92
- priority: 10
93
76
  }
77
+ };
78
+ },
79
+ config: {},
80
+ dimension: {
81
+ value: {
82
+ type: 'R',
83
+ name: "value",
84
+ priority: 20
94
85
  },
95
- init: function(){
96
- var tint, this$ = this;
97
- this.g = {
98
- view: d3.select(this.layout.getGroup('view')),
99
- link: d3.select(this.layout.getGroup('link')),
100
- legend: d3.select(this.layout.getGroup('legend'))
101
- };
102
- this.tint = tint = new chart.utils.tint();
103
- this.scale = {
104
- y: d3.scaleLinear()
105
- };
106
- this.layout.getGroup('view').addEventListener('mousemove', function(evt){
107
- var n;
108
- if (!((n = evt.target) && n.nodeName.toLowerCase() === 'rect')) {
109
- return;
86
+ name: {
87
+ type: 'N',
88
+ name: "name",
89
+ priority: 10
90
+ }
91
+ },
92
+ init: function(){
93
+ var tint, this$ = this;
94
+ this.g = {
95
+ view: d3.select(this.layout.getGroup('view')),
96
+ link: d3.select(this.layout.getGroup('link')),
97
+ legend: d3.select(this.layout.getGroup('legend'))
98
+ };
99
+ this.tint = tint = new chart.utils.tint();
100
+ this.scale = {
101
+ y: d3.scaleLinear()
102
+ };
103
+ this.layout.getGroup('view').addEventListener('mousemove', function(evt){
104
+ var n;
105
+ if (!((n = evt.target) && n.nodeName.toLowerCase() === 'rect')) {
106
+ return;
107
+ }
108
+ this$.idx = Array.from(n.parentNode.childNodes).indexOf(n);
109
+ return this$.renderDebounced();
110
+ });
111
+ return this.renderDebounced = debounce(350, function(){
112
+ return this$.render();
113
+ });
114
+ },
115
+ parse: function(){
116
+ var ref$, other, total, sum, i$, to$, idx, offset, i, ret, this$ = this;
117
+ ((ref$ = this.cfg).collapse || (ref$.collapse = {})).enabled = false;
118
+ this.parsed = this.data.map(function(it){
119
+ return import$({}, it);
120
+ });
121
+ this.parsed.sort(function(a, b){
122
+ return b.value - a.value;
123
+ });
124
+ if (this.cfg.collapse.enabled) {
125
+ if (this.cfg.collapse.method === 'count') {
126
+ other = this.parsed.splice(this.cfg.collapse.threshold || 7);
127
+ if (other.length) {
128
+ this.parsed.push({
129
+ name: t("other"),
130
+ value: other.reduce(function(a, b){
131
+ return a + b.value;
132
+ }, 0)
133
+ });
110
134
  }
111
- this$.idx = Array.from(n.parentNode.childNodes).indexOf(n);
112
- return this$.renderDebounced();
113
- });
114
- return this.renderDebounced = debounce(350, function(){
115
- return this$.render();
116
- });
117
- },
118
- parse: function(){
119
- var ref$, other, total, sum, i$, to$, idx, offset, i, ret, this$ = this;
120
- ((ref$ = this.cfg).collapse || (ref$.collapse = {})).enabled = false;
121
- this.parsed = this.data.map(function(it){
122
- return import$({}, it);
123
- });
124
- this.parsed.sort(function(a, b){
125
- return b.value - a.value;
126
- });
127
- if (this.cfg.collapse.enabled) {
128
- if (this.cfg.collapse.method === 'count') {
129
- other = this.parsed.splice(this.cfg.collapse.threshold || 7);
130
- if (other.length) {
131
- this.parsed.push({
132
- name: t("other"),
133
- value: other.reduce(function(a, b){
134
- return a + b.value;
135
- }, 0)
136
- });
135
+ } else {
136
+ ref$ = [
137
+ this.parsed.reduce(function(a, b){
138
+ return a + b.value;
139
+ }, 0), 0
140
+ ], total = ref$[0], sum = ref$[1];
141
+ for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
142
+ idx = i$;
143
+ sum += this.parsed[idx].value;
144
+ if (sum / total > (this.cfg.collapse.threshold || 0.75)) {
145
+ break;
137
146
  }
138
- } else {
139
- ref$ = [
140
- this.parsed.reduce(function(a, b){
147
+ }
148
+ other = this.parsed.splice(idx + 1);
149
+ if (other.length) {
150
+ this.parsed.push({
151
+ name: t("other"),
152
+ value: other.reduce(function(a, b){
141
153
  return a + b.value;
142
- }, 0), 0
143
- ], total = ref$[0], sum = ref$[1];
144
- for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
145
- idx = i$;
146
- sum += this.parsed[idx].value;
147
- if (sum / total > (this.cfg.collapse.threshold || 0.75)) {
148
- break;
149
- }
150
- }
151
- other = this.parsed.splice(idx + 1);
152
- if (other.length) {
153
- this.parsed.push({
154
- name: t("other"),
155
- value: other.reduce(function(a, b){
156
- return a + b.value;
157
- }, 0)
158
- });
159
- }
154
+ }, 0)
155
+ });
160
156
  }
161
157
  }
162
- this.tint.reset();
163
- this.parsed.map(function(it){
164
- return this$.tint.get(it.name || it._idx);
165
- });
166
- offset = 0;
167
- for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
168
- i = i$;
169
- ret = this.parsed[i];
170
- ret.offset = offset;
171
- offset += ret.value;
172
- }
173
- return this.total = offset || 1;
174
- },
175
- resize: function(){
176
- var node, box, ref$, w, h, size, this$ = this;
177
- this.layout.update(false);
178
- node = this.layout.getNode('legend');
179
- node.textContent = "";
180
- this.parsed.map(function(it){
181
- var div, p;
182
- div = document.createElement('div');
183
- p = (100 * (it.value / this$.total)).toFixed(1);
184
- div.textContent = it.text = it.name + " / " + p + "%";
185
- return node.appendChild(div);
186
- });
187
- this.nboxes = this.parsed.map(function(d, i){
188
- return this$.layout.getNode('legend').childNodes[i].getBoundingClientRect();
189
- });
190
- this.rbox = this.layout.getNode('legend').getBoundingClientRect();
191
- this.lbox = this.layout.getBox('link');
192
- box = this.layout.getBox('view');
193
- this.layout.update(false);
194
- box = this.layout.getBox('view');
195
- ref$ = [box.width, box.height], w = ref$[0], h = ref$[1];
196
- size = Math.min(w, h);
197
- return this.scale.y.range([0, box.height]).domain([0, this.total]);
198
- },
199
- render: function(){
200
- var total, cfg, layout, tint, scale, nboxes, rbox, lbox, box, offset, ref$, ref1$, ref2$, last, x$, y$, z$, z1$;
201
- total = this.total, cfg = this.cfg, layout = this.layout, tint = this.tint, scale = this.scale, nboxes = this.nboxes, rbox = this.rbox, lbox = this.lbox;
202
- if (this.cfg != null && this.cfg.palette) {
203
- this.tint.set(this.cfg.palette.colors.map(function(it){
204
- return it.value || it;
205
- }));
158
+ }
159
+ this.tint.reset();
160
+ this.parsed.map(function(it){
161
+ return this$.tint.get(it.name || it._idx);
162
+ });
163
+ offset = 0;
164
+ for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
165
+ i = i$;
166
+ ret = this.parsed[i];
167
+ ret.offset = offset;
168
+ offset += ret.value;
169
+ }
170
+ return this.total = offset || 1;
171
+ },
172
+ resize: function(){
173
+ var node, box, ref$, w, h, size, this$ = this;
174
+ this.layout.update(false);
175
+ node = this.layout.getNode('legend');
176
+ node.textContent = "";
177
+ this.parsed.map(function(it){
178
+ var div, p;
179
+ div = document.createElement('div');
180
+ p = (100 * (it.value / this$.total)).toFixed(1);
181
+ div.textContent = it.text = it.name + " / " + p + "%";
182
+ return node.appendChild(div);
183
+ });
184
+ this.nboxes = this.parsed.map(function(d, i){
185
+ return this$.layout.getNode('legend').childNodes[i].getBoundingClientRect();
186
+ });
187
+ this.rbox = this.layout.getNode('legend').getBoundingClientRect();
188
+ this.lbox = this.layout.getBox('link');
189
+ box = this.layout.getBox('view');
190
+ this.layout.update(false);
191
+ box = this.layout.getBox('view');
192
+ ref$ = [box.width, box.height], w = ref$[0], h = ref$[1];
193
+ size = Math.min(w, h);
194
+ return this.scale.y.range([0, box.height]).domain([0, this.total]);
195
+ },
196
+ render: function(){
197
+ var total, cfg, layout, tint, scale, nboxes, rbox, lbox, box, offset, ref$, ref1$, ref2$, last, x$, y$, z$, z1$;
198
+ total = this.total, cfg = this.cfg, layout = this.layout, tint = this.tint, scale = this.scale, nboxes = this.nboxes, rbox = this.rbox, lbox = this.lbox;
199
+ if (this.cfg != null && this.cfg.palette) {
200
+ this.tint.set(this.cfg.palette.colors.map(function(it){
201
+ return it.value || it;
202
+ }));
203
+ }
204
+ box = this.layout.getBox('view');
205
+ offset = 0;
206
+ if (this.idx != null && nboxes.length) {
207
+ this.idx = (ref$ = (ref1$ = this.idx) < (ref2$ = this.nboxes.length - 1) ? ref1$ : ref2$) > 0 ? ref$ : 0;
208
+ offset = nboxes[this.idx].y - rbox.y;
209
+ last = nboxes[nboxes.length - 1].y + nboxes[nboxes.length - 1].height - rbox.y;
210
+ if (last - offset < rbox.height) {
211
+ offset = last - rbox.height;
206
212
  }
207
- box = this.layout.getBox('view');
208
- offset = 0;
209
- if (this.idx != null && nboxes.length) {
210
- this.idx = (ref$ = (ref1$ = this.idx) < (ref2$ = this.nboxes.length - 1) ? ref1$ : ref2$) > 0 ? ref$ : 0;
211
- offset = nboxes[this.idx].y - rbox.y;
212
- last = nboxes[nboxes.length - 1].y + nboxes[nboxes.length - 1].height - rbox.y;
213
- if (last - offset < rbox.height) {
214
- offset = last - rbox.height;
213
+ }
214
+ x$ = this.g.view.selectAll('rect').data(this.parsed);
215
+ x$.exit().remove();
216
+ x$.enter().append('rect');
217
+ y$ = this.g.view.selectAll('rect');
218
+ y$.attr('x', function(){
219
+ return 0;
220
+ });
221
+ y$.attr('y', function(d, i){
222
+ return scale.y(d.offset);
223
+ });
224
+ y$.attr('width', function(){
225
+ return box.width;
226
+ });
227
+ y$.attr('height', function(d, i){
228
+ var ref$;
229
+ return (ref$ = scale.y(d.offset + d.value) - scale.y(d.offset) - 1) > 1 ? ref$ : 1;
230
+ });
231
+ y$.attr('fill', function(d, i){
232
+ var ret, nbox, y1;
233
+ return tint.get(Math.ceil(((d.offset + d.value / 2) / total) * 5));
234
+ ret = tint.get(0, (i % 3 - 1) / 5);
235
+ if (cfg.collapse.enabled) {
236
+ nbox = nboxes[i];
237
+ y1 = (nbox.y - rbox.y) + nbox.height / 2;
238
+ if (y1 < rbox.height) {
239
+ return ret;
215
240
  }
241
+ ret = ldcolor.hcl(ret);
242
+ ret.c = ret.c * 0.1;
243
+ ret.l = ret.l * 1.1;
244
+ }
245
+ return ldcolor.web(ret);
246
+ });
247
+ z$ = this.g.legend.selectAll('g.label').data(this.parsed);
248
+ z$.exit().remove();
249
+ z$.enter().append('g').attr('class', 'label');
250
+ this.g.legend.selectAll('g.label').each(function(d, i){
251
+ var n, ret;
252
+ if (this._text !== d.text) {
253
+ this._text = d.text;
254
+ n = layout.getNode('legend').childNodes[i];
255
+ ret = wrapSvgText({
256
+ node: n,
257
+ useRange: true
258
+ });
259
+ this.textContent = "";
260
+ return this.appendChild(ret);
216
261
  }
217
- x$ = this.g.view.selectAll('rect').data(this.parsed);
218
- x$.exit().remove();
219
- x$.enter().append('rect');
220
- y$ = this.g.view.selectAll('rect');
221
- y$.attr('x', function(){
262
+ }).transition().duration(350).attr('opacity', function(d, i){
263
+ var nbox, y;
264
+ nbox = nboxes[i];
265
+ y = nbox.y - rbox.y - offset;
266
+ if (y < 0 || y > rbox.height - nbox.height / 2) {
222
267
  return 0;
223
- });
224
- y$.attr('y', function(d, i){
225
- return scale.y(d.offset);
226
- });
227
- y$.attr('width', function(){
228
- return box.width;
229
- });
230
- y$.attr('height', function(d, i){
231
- var ref$;
232
- return (ref$ = scale.y(d.offset + d.value) - scale.y(d.offset) - 1) > 1 ? ref$ : 1;
233
- });
234
- y$.attr('fill', function(d, i){
235
- var ret, nbox, y1;
236
- return tint.get(Math.ceil(((d.offset + d.value / 2) / total) * 5));
237
- ret = tint.get(0, (i % 3 - 1) / 5);
238
- if (cfg.collapse.enabled) {
239
- nbox = nboxes[i];
240
- y1 = (nbox.y - rbox.y) + nbox.height / 2;
241
- if (y1 < rbox.height) {
242
- return ret;
243
- }
244
- ret = ldcolor.hcl(ret);
245
- ret.c = ret.c * 0.1;
246
- ret.l = ret.l * 1.1;
247
- }
248
- return ldcolor.web(ret);
249
- });
250
- z$ = this.g.legend.selectAll('g.label').data(this.parsed);
251
- z$.exit().remove();
252
- z$.enter().append('g').attr('class', 'label');
253
- this.g.legend.selectAll('g.label').each(function(d, i){
254
- var n, ret;
255
- if (this._text !== d.text) {
256
- this._text = d.text;
257
- n = layout.getNode('legend').childNodes[i];
258
- ret = wrapSvgText({
259
- node: n,
260
- useRange: true
261
- });
262
- this.textContent = "";
263
- return this.appendChild(ret);
264
- }
265
- }).transition().duration(350).attr('opacity', function(d, i){
266
- var nbox, y;
267
- nbox = nboxes[i];
268
- y = nbox.y - rbox.y - offset;
269
- if (y < 0 || y > rbox.height - nbox.height / 2) {
270
- return 0;
271
- } else {
272
- return 1;
273
- }
274
- }).attr('transform', function(d, i){
275
- var nbox;
276
- nbox = nboxes[i];
277
- return "translate(" + (nbox.x - rbox.x) + ", " + (nbox.y - rbox.y - offset) + ")";
278
- });
279
- z1$ = this.g.link.selectAll('path').data(this.parsed);
280
- z1$.exit().remove();
281
- z1$.enter().append('path').attr('fill', 'none').attr('stroke-width', 1);
282
- return this.g.link.selectAll('path').attr('stroke', function(d, i){
283
- return tint.get(Math.ceil(((d.offset + d.value / 2) / total) * 5));
284
- }).transition().duration(350).attr('d', function(d, i){
285
- var x0, x1, x2, x3, y0, nbox, y1;
286
- x0 = 0;
287
- x1 = lbox.width / 10;
288
- x2 = 9 * lbox.width / 10;
289
- x3 = lbox.width;
290
- y0 = scale.y(d.offset + d.value / 2);
291
- nbox = nboxes[i];
292
- y1 = (nbox.y - rbox.y) + nbox.height / 2 - offset;
293
- if (Math.abs(y1 - y0) < 2) {
294
- y1 = y0;
295
- }
296
- return "M" + x0 + " " + y0 + " L" + x1 + " " + y0 + " L" + x2 + " " + y1 + " L" + x3 + " " + y1;
297
- }).attr('opacity', function(d, i){
298
- var nbox, y0, y1;
299
- nbox = nboxes[i];
300
- y0 = scale.y(d.offset + d.value / 2);
301
- y1 = (nbox.y - rbox.y) + nbox.height / 2 - offset;
302
- if (Math.abs(y1 - y0) < 2) {
303
- y1 = y0;
304
- }
305
- return y1 > rbox.height || y1 < 0 ? 0 : 1;
306
- });
307
- }
308
- };
268
+ } else {
269
+ return 1;
270
+ }
271
+ }).attr('transform', function(d, i){
272
+ var nbox;
273
+ nbox = nboxes[i];
274
+ return "translate(" + (nbox.x - rbox.x) + ", " + (nbox.y - rbox.y - offset) + ")";
275
+ });
276
+ z1$ = this.g.link.selectAll('path').data(this.parsed);
277
+ z1$.exit().remove();
278
+ z1$.enter().append('path').attr('fill', 'none').attr('stroke-width', 1);
279
+ return this.g.link.selectAll('path').attr('stroke', function(d, i){
280
+ return tint.get(Math.ceil(((d.offset + d.value / 2) / total) * 5));
281
+ }).transition().duration(350).attr('d', function(d, i){
282
+ var x0, x1, x2, x3, y0, nbox, y1;
283
+ x0 = 0;
284
+ x1 = lbox.width / 10;
285
+ x2 = 9 * lbox.width / 10;
286
+ x3 = lbox.width;
287
+ y0 = scale.y(d.offset + d.value / 2);
288
+ nbox = nboxes[i];
289
+ y1 = (nbox.y - rbox.y) + nbox.height / 2 - offset;
290
+ if (Math.abs(y1 - y0) < 2) {
291
+ y1 = y0;
292
+ }
293
+ return "M" + x0 + " " + y0 + " L" + x1 + " " + y0 + " L" + x2 + " " + y1 + " L" + x3 + " " + y1;
294
+ }).attr('opacity', function(d, i){
295
+ var nbox, y0, y1;
296
+ nbox = nboxes[i];
297
+ y0 = scale.y(d.offset + d.value / 2);
298
+ y1 = (nbox.y - rbox.y) + nbox.height / 2 - offset;
299
+ if (Math.abs(y1 - y0) < 2) {
300
+ y1 = y0;
301
+ }
302
+ return y1 > rbox.height || y1 < 0 ? 0 : 1;
303
+ });
304
+ }
309
305
  };
310
- return blockFactory;
311
- });
306
+ };
312
307
  function import$(obj, src){
313
308
  var own = {}.hasOwnProperty;
314
309
  for (var key in src) if (own.call(src, key)) obj[key] = src[key];