@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.
- package/CHANGELOG.md +11 -1
- package/build +11 -5
- package/dist/index.css +8 -0
- package/dist/index.js +607 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/package.json +12 -9
- package/src/{chart.ls → index.ls} +0 -0
- package/src/{chart.styl → index.styl} +0 -0
- package/web/src/pug/base.pug +1 -0
- package/web/src/pug/block/axis/0.0.1/index.ls +1 -7
- package/web/src/pug/block/axis-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-list/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-race/0.0.1/index.ls +1 -5
- package/web/src/pug/block/base/0.0.1/index.ls +63 -64
- package/web/src/pug/block/blank/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bubble/0.0.1/index.ls +4 -6
- package/web/src/pug/block/bubble/0.0.1/index.pug +14 -0
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/dumbbell/0.0.1/index.ls +1 -5
- package/web/src/pug/block/empty/0.0.1/index.ls +25 -24
- package/web/src/pug/block/gauge/0.0.1/index.ls +1 -5
- package/web/src/pug/block/line/0.0.1/index.ls +1 -6
- package/web/src/pug/block/number/0.0.1/index.ls +1 -5
- package/web/src/pug/block/percent-list/0.0.1/index.ls +1 -7
- package/web/src/pug/block/pie/0.0.1/index.ls +1 -5
- package/web/src/pug/block/pie-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/radar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/scatter/0.0.1/index.ls +1 -5
- package/web/src/pug/block/sheet/0.0.1/index.ls +1 -5
- package/web/src/pug/block/table/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwancounty/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwantown/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +1 -5
- package/web/src/pug/block/treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/wordcloud/0.0.1/index.ls +1 -5
- package/web/src/pug/block/worldmap/0.0.1/index.ls +1 -5
- package/web/src/styl/index.styl +6 -0
- package/web/static/block/axis/0.0.1/index.html +68 -73
- package/web/static/block/axis-bubble/0.0.1/index.html +205 -210
- package/web/static/block/bar/0.0.1/index.html +484 -489
- package/web/static/block/bar-list/0.0.1/index.html +188 -193
- package/web/static/block/bar-race/0.0.1/index.html +155 -160
- package/web/static/block/base/0.0.1/index.html +2 -2
- package/web/static/block/blank/0.0.1/index.html +35 -40
- package/web/static/block/bubble/0.0.1/index.html +377 -357
- package/web/static/block/curve-bar/0.0.1/index.html +126 -131
- package/web/static/block/dumbbell/0.0.1/index.html +160 -165
- package/web/static/block/empty/0.0.1/index.html +2 -2
- package/web/static/block/gauge/0.0.1/index.html +116 -121
- package/web/static/block/line/0.0.1/index.html +502 -507
- package/web/static/block/number/0.0.1/index.html +123 -128
- package/web/static/block/percent-list/0.0.1/index.html +263 -268
- package/web/static/block/pie/0.0.1/index.html +241 -246
- package/web/static/block/pie-bubble/0.0.1/index.html +295 -300
- package/web/static/block/radar/0.0.1/index.html +137 -142
- package/web/static/block/scatter/0.0.1/index.html +207 -212
- package/web/static/block/sheet/0.0.1/index.html +93 -98
- package/web/static/block/table/0.0.1/index.html +64 -70
- package/web/static/block/taiwancounty/0.0.1/index.html +180 -185
- package/web/static/block/taiwantown/0.0.1/index.html +104 -109
- package/web/static/block/taiwanvillage/0.0.1/index.html +114 -119
- package/web/static/block/treemap/0.0.1/index.html +296 -301
- package/web/static/block/voronoi-treemap/0.0.1/index.html +311 -316
- package/web/static/block/wordcloud/0.0.1/index.html +82 -87
- package/web/static/block/worldmap/0.0.1/index.html +186 -191
- package/web/static/css/index.css +6 -0
- package/web/static/css/index.min.css +1 -0
- package/web/static/index.html +1 -1
|
@@ -25,545 +25,540 @@
|
|
|
25
25
|
grid-column: 1/span 2;
|
|
26
26
|
grid-row: 3;
|
|
27
27
|
}
|
|
28
|
-
</style><script type="@plotdb/block">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
name:
|
|
35
|
-
version:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
</style><script type="@plotdb/block">var mod;
|
|
29
|
+
module.exports = {
|
|
30
|
+
pkg: {
|
|
31
|
+
name: 'line',
|
|
32
|
+
version: '0.0.1',
|
|
33
|
+
extend: {
|
|
34
|
+
name: "base",
|
|
35
|
+
version: "0.0.1"
|
|
36
|
+
},
|
|
37
|
+
dependencies: [],
|
|
38
|
+
i18n: {
|
|
39
|
+
"zh-TW": {
|
|
40
|
+
"y axis": "Y軸",
|
|
41
|
+
"x axis": "X軸",
|
|
42
|
+
"rank": "順位"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
init: function(arg$){
|
|
47
|
+
var root, context, pubsub, t;
|
|
48
|
+
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub, t = arg$.t;
|
|
49
|
+
return pubsub.fire('init', {
|
|
50
|
+
mod: mod({
|
|
51
|
+
context: context,
|
|
52
|
+
t: t
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
mod = function(arg$){
|
|
58
|
+
var context, t, d3, chart, axis, format, sampleCount;
|
|
59
|
+
context = arg$.context, t = arg$.t;
|
|
60
|
+
d3 = context.d3, chart = context.chart, axis = context.axis, format = context.format;
|
|
61
|
+
sampleCount = 4;
|
|
62
|
+
return {
|
|
63
|
+
sample: function(){
|
|
64
|
+
return {
|
|
65
|
+
raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30].map(function(val){
|
|
66
|
+
var ret;
|
|
67
|
+
ret = {};
|
|
68
|
+
(function(){
|
|
69
|
+
var i$, to$, results$ = [];
|
|
70
|
+
for (i$ = 1, to$ = sampleCount; i$ <= to$; ++i$) {
|
|
71
|
+
results$.push(i$);
|
|
72
|
+
}
|
|
73
|
+
return results$;
|
|
74
|
+
}()).map(function(i){
|
|
75
|
+
var ref$;
|
|
76
|
+
return ret["val" + i] = (ref$ = i * Math.random() * (10 - Math.abs(10 - val)) + val) > 0 ? ref$ : 0;
|
|
77
|
+
});
|
|
78
|
+
ret.order = val;
|
|
79
|
+
return ret;
|
|
80
|
+
}),
|
|
81
|
+
binding: {
|
|
82
|
+
value: (function(){
|
|
83
|
+
var i$, to$, results$ = [];
|
|
84
|
+
for (i$ = 1, to$ = sampleCount; i$ <= to$; ++i$) {
|
|
85
|
+
results$.push(i$);
|
|
86
|
+
}
|
|
87
|
+
return results$;
|
|
88
|
+
}()).map(function(it){
|
|
89
|
+
return {
|
|
90
|
+
key: "val" + it
|
|
91
|
+
};
|
|
92
|
+
}),
|
|
93
|
+
order: {
|
|
94
|
+
key: 'order'
|
|
95
|
+
}
|
|
46
96
|
}
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
config: {
|
|
100
|
+
mode: {
|
|
101
|
+
type: 'choice',
|
|
102
|
+
values: ['line', 'area', 'streamgraph', 'bump'],
|
|
103
|
+
'default': 'line'
|
|
104
|
+
},
|
|
105
|
+
stack: {
|
|
106
|
+
type: 'boolean'
|
|
107
|
+
},
|
|
108
|
+
line: {
|
|
109
|
+
type: 'choice',
|
|
110
|
+
values: ['curve', 'linear'],
|
|
111
|
+
'default': 'linear'
|
|
112
|
+
},
|
|
113
|
+
showDot: {
|
|
114
|
+
type: 'boolean',
|
|
115
|
+
'default': true
|
|
47
116
|
}
|
|
48
117
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
118
|
+
dimension: {
|
|
119
|
+
value: {
|
|
120
|
+
type: 'R',
|
|
121
|
+
name: "y axis",
|
|
122
|
+
multiple: true
|
|
123
|
+
},
|
|
124
|
+
order: {
|
|
125
|
+
type: 'ON',
|
|
126
|
+
name: "x axis"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
init: function(){
|
|
130
|
+
var svg, tint, this$ = this;
|
|
131
|
+
svg = d3.select(this.svg);
|
|
132
|
+
['view', 'yaxis', 'xaxis', 'legend'].map(function(it){
|
|
133
|
+
return (this$.g || (this$.g = {}))[it] = d3.select(this$.layout.getGroup(it));
|
|
57
134
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
135
|
+
this.tint = tint = new chart.utils.tint();
|
|
136
|
+
this.line = d3.line().defined(function(it){
|
|
137
|
+
return !isNaN(it.y1);
|
|
138
|
+
}).x(function(it){
|
|
139
|
+
return this$.scale.x(it.x);
|
|
140
|
+
}).y(function(it){
|
|
141
|
+
return this$.scale.y(it.y1);
|
|
142
|
+
});
|
|
143
|
+
this.area = d3.area().defined(function(it){
|
|
144
|
+
return !isNaN(it.y1) && !isNaN(it.y0);
|
|
145
|
+
}).x(function(it){
|
|
146
|
+
return this$.scale.x(it.x);
|
|
147
|
+
}).y0(function(it){
|
|
148
|
+
return this$.scale.y(it.y0);
|
|
149
|
+
}).y1(function(it){
|
|
150
|
+
return this$.scale.y(it.y1);
|
|
151
|
+
});
|
|
152
|
+
this.xaxis = new chart.utils.axis({
|
|
153
|
+
layout: this.layout,
|
|
154
|
+
name: 'xaxis',
|
|
155
|
+
direction: 'bottom'
|
|
156
|
+
});
|
|
157
|
+
this.yaxis = new chart.utils.axis({
|
|
158
|
+
layout: this.layout,
|
|
159
|
+
name: 'yaxis',
|
|
160
|
+
direction: 'left'
|
|
161
|
+
});
|
|
162
|
+
this.tip = new chart.utils.tip({
|
|
163
|
+
root: this.root,
|
|
164
|
+
range: function(){
|
|
165
|
+
return this$.layout.getNode('view').getBoundingClientRect();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
this._evthdr = {};
|
|
169
|
+
this.root.addEventListener('mouseout', this._evthdr.out = function(evt){
|
|
170
|
+
return this$.tip.hide().now();
|
|
171
|
+
});
|
|
172
|
+
this.root.addEventListener('mousemove', this._evthdr.move = function(evt){
|
|
173
|
+
var x, y, min, i$, to$, i, series, j$, to1$, j, p, dx, dy, d, bind, pt, data, box;
|
|
174
|
+
x = evt.clientX - this$.layout.getNode('view').getBoundingClientRect().x;
|
|
175
|
+
y = evt.clientY - this$.layout.getNode('view').getBoundingClientRect().y;
|
|
176
|
+
min = {
|
|
177
|
+
d: -1,
|
|
178
|
+
p: null,
|
|
179
|
+
series: null
|
|
180
|
+
};
|
|
181
|
+
for (i$ = 0, to$ = this$.parsed.length; i$ < to$; ++i$) {
|
|
182
|
+
i = i$;
|
|
183
|
+
series = this$.parsed[i];
|
|
184
|
+
for (j$ = 0, to1$ = series.pts.length; j$ < to1$; ++j$) {
|
|
185
|
+
j = j$;
|
|
186
|
+
p = series.pts[j];
|
|
187
|
+
if (isNaN(p.y1) || isNaN(p.x)) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
dx = Math.abs(this$.scale.x(p.x) - x);
|
|
191
|
+
dy = Math.abs(this$.scale.y(p.y1) - y);
|
|
192
|
+
d = Math.pow(dx, 2) + Math.pow(dy, 2);
|
|
193
|
+
if (min.d < 0 || min.d > d) {
|
|
194
|
+
min.d = d;
|
|
195
|
+
min.p = p;
|
|
196
|
+
min.series = series;
|
|
98
197
|
}
|
|
99
198
|
}
|
|
199
|
+
}
|
|
200
|
+
if (!(min.p && min.d && min.series)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
bind = min.series.bind;
|
|
204
|
+
pt = min.p;
|
|
205
|
+
data = {
|
|
206
|
+
name: (bind ? bind.name || bind.key || '' : void 8) + " /\n" + (pt.data.orderText || pt.data.order || pt.x) + (this$.binding.order.unit || ''),
|
|
207
|
+
value: isNaN(pt.v)
|
|
208
|
+
? '-'
|
|
209
|
+
: pt.v.toFixed(2) + "" + (bind ? bind.unit || '' : '')
|
|
100
210
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
211
|
+
box = {
|
|
212
|
+
x: this$.scale.x(pt.x),
|
|
213
|
+
y: this$.scale.y(pt.y)
|
|
214
|
+
};
|
|
215
|
+
return this$.tip.render({
|
|
216
|
+
data: data,
|
|
217
|
+
evt: evt,
|
|
218
|
+
box: box
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
this.legend = new chart.utils.legend({
|
|
222
|
+
layout: this.layout,
|
|
223
|
+
root: this.root,
|
|
224
|
+
name: 'legend',
|
|
225
|
+
shape: function(d){
|
|
226
|
+
return d3.select(this).attr('fill', tint.get(d.text));
|
|
115
227
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
228
|
+
direction: 'vertical',
|
|
229
|
+
cfg: {
|
|
230
|
+
selectable: true
|
|
119
231
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
232
|
+
});
|
|
233
|
+
this.legend.on('select', function(){
|
|
234
|
+
this$.bind();
|
|
235
|
+
this$.resize();
|
|
236
|
+
return this$.render();
|
|
237
|
+
});
|
|
238
|
+
return this.scale = {
|
|
239
|
+
x: d3.scaleLinear(),
|
|
240
|
+
y: d3.scaleLinear()
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
destroy: function(){
|
|
244
|
+
this.root.removeEventListener('mouseout', this._evthdr.out);
|
|
245
|
+
this.root.removeEventListener('mousemove', this._evthdr.move);
|
|
246
|
+
return this.tip.destroy();
|
|
247
|
+
},
|
|
248
|
+
parse: function(){
|
|
249
|
+
this.data.map(function(d, i){
|
|
250
|
+
d.orderText = '' + (!(d.order != null)
|
|
251
|
+
? i
|
|
252
|
+
: d.order);
|
|
253
|
+
return d._order = !(d.order != null) || isNaN(+d.order)
|
|
254
|
+
? i
|
|
255
|
+
: +d.order;
|
|
256
|
+
});
|
|
257
|
+
this.data.sort(function(a, b){
|
|
258
|
+
if (a._order > b._order) {
|
|
259
|
+
return 1;
|
|
260
|
+
} else if (a._order === b._order) {
|
|
261
|
+
return 0;
|
|
262
|
+
} else {
|
|
263
|
+
return -1;
|
|
130
264
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return this$.layout.getNode('view').getBoundingClientRect();
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
this._evthdr = {};
|
|
172
|
-
this.root.addEventListener('mouseout', this._evthdr.out = function(evt){
|
|
173
|
-
return this$.tip.hide().now();
|
|
174
|
-
});
|
|
175
|
-
this.root.addEventListener('mousemove', this._evthdr.move = function(evt){
|
|
176
|
-
var x, y, min, i$, to$, i, series, j$, to1$, j, p, dx, dy, d, bind, pt, data, box;
|
|
177
|
-
x = evt.clientX - this$.layout.getNode('view').getBoundingClientRect().x;
|
|
178
|
-
y = evt.clientY - this$.layout.getNode('view').getBoundingClientRect().y;
|
|
179
|
-
min = {
|
|
180
|
-
d: -1,
|
|
181
|
-
p: null,
|
|
182
|
-
series: null
|
|
183
|
-
};
|
|
184
|
-
for (i$ = 0, to$ = this$.parsed.length; i$ < to$; ++i$) {
|
|
185
|
-
i = i$;
|
|
186
|
-
series = this$.parsed[i];
|
|
187
|
-
for (j$ = 0, to1$ = series.pts.length; j$ < to1$; ++j$) {
|
|
188
|
-
j = j$;
|
|
189
|
-
p = series.pts[j];
|
|
190
|
-
if (isNaN(p.y1) || isNaN(p.x)) {
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
dx = Math.abs(this$.scale.x(p.x) - x);
|
|
194
|
-
dy = Math.abs(this$.scale.y(p.y1) - y);
|
|
195
|
-
d = Math.pow(dx, 2) + Math.pow(dy, 2);
|
|
196
|
-
if (min.d < 0 || min.d > d) {
|
|
197
|
-
min.d = d;
|
|
198
|
-
min.p = p;
|
|
199
|
-
min.series = series;
|
|
200
|
-
}
|
|
265
|
+
});
|
|
266
|
+
return this.legend.data(this.binding.value.map(function(it){
|
|
267
|
+
return {
|
|
268
|
+
key: it.key,
|
|
269
|
+
text: it.key
|
|
270
|
+
};
|
|
271
|
+
}));
|
|
272
|
+
},
|
|
273
|
+
bind: function(){
|
|
274
|
+
var binds, dd, sums, ref$, smin, smax, line0, i$, to$, i, p, b, line1, this$ = this, results$ = [];
|
|
275
|
+
binds = this.binding.value;
|
|
276
|
+
binds = this.binding.value.map(function(b, i){
|
|
277
|
+
return {
|
|
278
|
+
b: b,
|
|
279
|
+
i: i
|
|
280
|
+
};
|
|
281
|
+
}).filter(function(d, i){
|
|
282
|
+
return this$.legend.isSelected(d.b.key);
|
|
283
|
+
});
|
|
284
|
+
if (this.cfg.mode === 'bump') {
|
|
285
|
+
this.parsed = [];
|
|
286
|
+
dd = this.data.map(function(d){
|
|
287
|
+
var ret, v;
|
|
288
|
+
ret = import$({}, d);
|
|
289
|
+
v = ret.value.map(function(d, i){
|
|
290
|
+
return {
|
|
291
|
+
i: i,
|
|
292
|
+
v: this$.legend.isSelected(this$.binding.value[i].key) ? d : NaN
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
v.sort(function(a, b){
|
|
296
|
+
if (isNaN(a.v) && isNaN(b.v)) {
|
|
297
|
+
return 0;
|
|
298
|
+
} else if (isNaN(b.v)) {
|
|
299
|
+
return -1;
|
|
300
|
+
} else if (isNaN(a.v)) {
|
|
301
|
+
return 1;
|
|
201
302
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
bind = min.series.bind;
|
|
207
|
-
pt = min.p;
|
|
208
|
-
data = {
|
|
209
|
-
name: (bind ? bind.name || bind.key || '' : void 8) + " /\n" + (pt.data.orderText || pt.data.order || pt.x) + (this$.binding.order.unit || ''),
|
|
210
|
-
value: isNaN(pt.v)
|
|
211
|
-
? '-'
|
|
212
|
-
: pt.v.toFixed(2) + "" + (bind ? bind.unit || '' : '')
|
|
213
|
-
};
|
|
214
|
-
box = {
|
|
215
|
-
x: this$.scale.x(pt.x),
|
|
216
|
-
y: this$.scale.y(pt.y)
|
|
217
|
-
};
|
|
218
|
-
return this$.tip.render({
|
|
219
|
-
data: data,
|
|
220
|
-
evt: evt,
|
|
221
|
-
box: box
|
|
303
|
+
return b.v - a.v;
|
|
304
|
+
});
|
|
305
|
+
v.map(function(d, i){
|
|
306
|
+
return d.r = i + 1;
|
|
222
307
|
});
|
|
308
|
+
v.sort(function(a, b){
|
|
309
|
+
return a.i - b.i;
|
|
310
|
+
});
|
|
311
|
+
ret.value = v.map(function(it){
|
|
312
|
+
if (isNaN(it.v)) {
|
|
313
|
+
return NaN;
|
|
314
|
+
} else {
|
|
315
|
+
return it.r;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
ret.originalValue = v.map(function(it){
|
|
319
|
+
return it.v;
|
|
320
|
+
});
|
|
321
|
+
return ret;
|
|
223
322
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
selectable: true
|
|
323
|
+
}
|
|
324
|
+
dd = dd || this.data;
|
|
325
|
+
if (this.cfg.mode === 'streamgraph') {
|
|
326
|
+
sums = dd.map(function(d){
|
|
327
|
+
var sum, i$, to$, i;
|
|
328
|
+
sum = 0;
|
|
329
|
+
for (i$ = 0, to$ = d.value.length; i$ < to$; ++i$) {
|
|
330
|
+
i = i$;
|
|
331
|
+
sum += d.value[i];
|
|
234
332
|
}
|
|
333
|
+
return sum;
|
|
235
334
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
return this.scale = {
|
|
242
|
-
x: d3.scaleLinear(),
|
|
243
|
-
y: d3.scaleLinear()
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
destroy: function(){
|
|
247
|
-
this.root.removeEventListener('mouseout', this._evthdr.out);
|
|
248
|
-
this.root.removeEventListener('mousemove', this._evthdr.move);
|
|
249
|
-
return this.tip.destroy();
|
|
250
|
-
},
|
|
251
|
-
parse: function(){
|
|
252
|
-
this.data.map(function(d, i){
|
|
253
|
-
d.orderText = '' + (!(d.order != null)
|
|
254
|
-
? i
|
|
255
|
-
: d.order);
|
|
256
|
-
return d._order = !(d.order != null) || isNaN(+d.order)
|
|
257
|
-
? i
|
|
258
|
-
: +d.order;
|
|
259
|
-
});
|
|
260
|
-
this.data.sort(function(a, b){
|
|
261
|
-
if (a._order > b._order) {
|
|
262
|
-
return 1;
|
|
263
|
-
} else if (a._order === b._order) {
|
|
335
|
+
ref$ = [Math.min.apply(Math, sums), Math.max.apply(Math, sums)], smin = ref$[0], smax = ref$[1];
|
|
336
|
+
} else {
|
|
337
|
+
ref$ = [
|
|
338
|
+
dd.map(function(){
|
|
264
339
|
return 0;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return {
|
|
281
|
-
b: b,
|
|
282
|
-
i: i
|
|
283
|
-
};
|
|
284
|
-
}).filter(function(d, i){
|
|
285
|
-
return this$.legend.isSelected(d.b.key);
|
|
340
|
+
}), 0, 0
|
|
341
|
+
], sums = ref$[0], smin = ref$[1], smax = ref$[2];
|
|
342
|
+
}
|
|
343
|
+
this.parsed = [];
|
|
344
|
+
line0 = dd.map(function(){
|
|
345
|
+
return 0;
|
|
346
|
+
});
|
|
347
|
+
for (i$ = 0, to$ = binds.length; i$ < to$; ++i$) {
|
|
348
|
+
i = i$;
|
|
349
|
+
ref$ = [i > 0 ? binds[i - 1] : null, binds[i]], p = ref$[0], b = ref$[1];
|
|
350
|
+
line1 = dd.map(fn$);
|
|
351
|
+
this.parsed.push({
|
|
352
|
+
pts: (dd || this.data).map(fn1$),
|
|
353
|
+
bind: b.b,
|
|
354
|
+
color: b.b.name || b.b.key
|
|
286
355
|
});
|
|
287
|
-
if (this.cfg.mode
|
|
288
|
-
|
|
289
|
-
dd = this.data.map(function(d){
|
|
290
|
-
var ret, v;
|
|
291
|
-
ret = import$({}, d);
|
|
292
|
-
v = ret.value.map(function(d, i){
|
|
293
|
-
return {
|
|
294
|
-
i: i,
|
|
295
|
-
v: this$.legend.isSelected(this$.binding.value[i].key) ? d : NaN
|
|
296
|
-
};
|
|
297
|
-
});
|
|
298
|
-
v.sort(function(a, b){
|
|
299
|
-
if (isNaN(a.v) && isNaN(b.v)) {
|
|
300
|
-
return 0;
|
|
301
|
-
} else if (isNaN(b.v)) {
|
|
302
|
-
return -1;
|
|
303
|
-
} else if (isNaN(a.v)) {
|
|
304
|
-
return 1;
|
|
305
|
-
}
|
|
306
|
-
return b.v - a.v;
|
|
307
|
-
});
|
|
308
|
-
v.map(function(d, i){
|
|
309
|
-
return d.r = i + 1;
|
|
310
|
-
});
|
|
311
|
-
v.sort(function(a, b){
|
|
312
|
-
return a.i - b.i;
|
|
313
|
-
});
|
|
314
|
-
ret.value = v.map(function(it){
|
|
315
|
-
if (isNaN(it.v)) {
|
|
316
|
-
return NaN;
|
|
317
|
-
} else {
|
|
318
|
-
return it.r;
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
ret.originalValue = v.map(function(it){
|
|
322
|
-
return it.v;
|
|
323
|
-
});
|
|
324
|
-
return ret;
|
|
325
|
-
});
|
|
356
|
+
if ((this.cfg.stack && this.cfg.mode !== 'bump') || ((ref$ = this.cfg.mode) === 'streamgraph' || ref$ === 'area')) {
|
|
357
|
+
results$.push(line0 = line1);
|
|
326
358
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
359
|
+
}
|
|
360
|
+
return results$;
|
|
361
|
+
function fn$(d, j){
|
|
362
|
+
return d.value[b.i] + line0[j];
|
|
363
|
+
}
|
|
364
|
+
function fn1$(d, j){
|
|
365
|
+
return {
|
|
366
|
+
data: d,
|
|
367
|
+
y0: line0[j] - sums[j] / 2 + (smax - smin) / 2,
|
|
368
|
+
y1: line1[j] - sums[j] / 2 + (smax - smin) / 2,
|
|
369
|
+
x: d._order,
|
|
370
|
+
v: d.originalValue
|
|
371
|
+
? d.originalValue[i]
|
|
372
|
+
: d.value[i]
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
resize: function(){
|
|
377
|
+
var ref$, miny, maxy, i$, to$, i, j$, to1$, j, p, w, h, maxTick, yticks, ref1$, yfmt, units, v, box, r, results$ = [];
|
|
378
|
+
this.line.curve(this.cfg.line === 'curve'
|
|
379
|
+
? d3.curveCatmullRom
|
|
380
|
+
: d3.curveLinear);
|
|
381
|
+
this.area.curve(this.cfg.line === 'curve'
|
|
382
|
+
? d3.curveCatmullRom
|
|
383
|
+
: d3.curveLinear);
|
|
384
|
+
this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
|
|
385
|
+
ref$ = [0, 0], miny = ref$[0], maxy = ref$[1];
|
|
386
|
+
for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
|
|
387
|
+
i = i$;
|
|
388
|
+
for (j$ = 0, to1$ = this.parsed[i].pts.length; j$ < to1$; ++j$) {
|
|
389
|
+
j = j$;
|
|
390
|
+
p = this.parsed[i].pts[j];
|
|
391
|
+
if (!isNaN(p.y0) && miny > p.y0) {
|
|
392
|
+
miny = p.y0;
|
|
393
|
+
}
|
|
394
|
+
if (!isNaN(p.y1) && miny > p.y1) {
|
|
395
|
+
miny = p.y1;
|
|
396
|
+
}
|
|
397
|
+
if (!isNaN(p.y0) && maxy < p.y0) {
|
|
398
|
+
maxy = p.y0;
|
|
399
|
+
}
|
|
400
|
+
if (!isNaN(p.y1) && maxy < p.y1) {
|
|
401
|
+
maxy = p.y1;
|
|
402
|
+
}
|
|
345
403
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
404
|
+
}
|
|
405
|
+
this.extent = {
|
|
406
|
+
x: d3.extent(this.data, function(it){
|
|
407
|
+
return it._order;
|
|
408
|
+
}),
|
|
409
|
+
y: [this.cfg.mode === 'bump' ? miny > 1 ? miny : 1 : miny, maxy === miny ? miny + 1 : maxy]
|
|
410
|
+
};
|
|
411
|
+
this.scale.x.domain(this.extent.x);
|
|
412
|
+
this.scale.y.domain(this.cfg.mode === 'bump'
|
|
413
|
+
? [this.extent.y[1], this.extent.y[0]]
|
|
414
|
+
: this.extent.y);
|
|
415
|
+
ref$ = [this.box.width, this.box.height], w = ref$[0], h = ref$[1];
|
|
416
|
+
maxTick = (ref$ = Math.ceil(this.layout.getBox('yaxis').height / 40)) > 2 ? ref$ : 2;
|
|
417
|
+
yticks = this.cfg.mode === 'bump'
|
|
418
|
+
? (function(){
|
|
419
|
+
var i$, to$, ref$, results$ = [];
|
|
420
|
+
for (i$ = 1, to$ = (ref$ = this.parsed.length || 1) > 1 ? ref$ : 1; i$ <= to$; ++i$) {
|
|
421
|
+
results$.push(i$);
|
|
422
|
+
}
|
|
423
|
+
return results$;
|
|
424
|
+
}.call(this))
|
|
425
|
+
: this.scale.y.ticks((ref$ = ((ref1$ = this.cfg).yaxis || (ref1$.yaxis = {})).tickCount || 4) < maxTick ? ref$ : maxTick);
|
|
426
|
+
yfmt = chart.utils.format.auto(yticks);
|
|
427
|
+
this.legend.config(this.cfg.legend);
|
|
428
|
+
this.legend.update();
|
|
429
|
+
this.yaxis.config(this.cfg.yaxis);
|
|
430
|
+
this.yaxis.ticks(yticks);
|
|
431
|
+
this.yaxis.scale(this.scale.y);
|
|
432
|
+
if (this.cfg.mode === 'bump') {
|
|
433
|
+
this.yaxis.caption(t('rank'));
|
|
434
|
+
} else {
|
|
435
|
+
if (this.parsed.length > 1) {
|
|
436
|
+
units = Array.from(new Set(this.parsed.map(function(it){
|
|
437
|
+
return it.bind.unit;
|
|
438
|
+
}))).filter(function(it){
|
|
439
|
+
return it;
|
|
358
440
|
});
|
|
359
|
-
if (
|
|
360
|
-
|
|
441
|
+
if (units.length > 1) {
|
|
442
|
+
this.yaxis.caption('');
|
|
443
|
+
} else {
|
|
444
|
+
this.yaxis.caption(units[0] || '');
|
|
361
445
|
}
|
|
446
|
+
} else {
|
|
447
|
+
v = (this.parsed[0] || {}).bind || {};
|
|
448
|
+
this.yaxis.caption((v.name || v.key || '') + (v.unit ? "(" + v.unit + ")" : ''));
|
|
362
449
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
450
|
+
}
|
|
451
|
+
this.xaxis.config(this.cfg.xaxis);
|
|
452
|
+
this.xaxis.ticks(this.data.map(function(it){
|
|
453
|
+
return {
|
|
454
|
+
v: it._order,
|
|
455
|
+
t: it.orderText
|
|
456
|
+
};
|
|
457
|
+
}));
|
|
458
|
+
this.xaxis.scale(this.scale.x);
|
|
459
|
+
this.xaxis.caption((this.binding.order.name || this.binding.order.key) + (this.binding.order.unit ? "(" + this.binding.order.unit + ")" : ''));
|
|
460
|
+
for (i$ = 0; i$ < 2; ++i$) {
|
|
461
|
+
i = i$;
|
|
462
|
+
this.layout.update(false);
|
|
463
|
+
box = this.layout.getBox('view');
|
|
464
|
+
ref$ = [box.width, box.height], w = ref$[0], h = ref$[1];
|
|
465
|
+
this.tint.set(this.cfg.palette);
|
|
466
|
+
r = this.cfg.dotSize || 3;
|
|
467
|
+
this.scale.x.range([0, w - r]);
|
|
468
|
+
this.scale.y.range([h, r]);
|
|
469
|
+
this.xaxis.render();
|
|
470
|
+
results$.push(this.yaxis.render());
|
|
471
|
+
}
|
|
472
|
+
return results$;
|
|
473
|
+
},
|
|
474
|
+
render: function(){
|
|
475
|
+
var scale, tint, extent, r, vbox, lbox, x$, y$, this$ = this;
|
|
476
|
+
scale = this.scale, tint = this.tint, extent = this.extent;
|
|
477
|
+
r = this.cfg.dotSize || 3;
|
|
478
|
+
vbox = this.layout.getBox('view');
|
|
479
|
+
lbox = this.layout.getBox('yaxis');
|
|
480
|
+
x$ = this.g.view.selectAll('path.data').data(this.parsed, function(it){
|
|
481
|
+
return it.bind.key;
|
|
482
|
+
});
|
|
483
|
+
x$.exit().remove();
|
|
484
|
+
x$.enter().append('path').attr('class', 'data').attr('fill', 'none').attr('d', function(d, i){
|
|
485
|
+
var ref$;
|
|
486
|
+
if ((ref$ = this$.cfg.mode) === 'streamgraph' || ref$ === 'area') {
|
|
487
|
+
return this$.area(d.pts);
|
|
488
|
+
} else {
|
|
489
|
+
return this$.line(d.pts);
|
|
366
490
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
: d.value[i]
|
|
376
|
-
};
|
|
491
|
+
}).attr('stroke', function(d, i){
|
|
492
|
+
return this$.tint.get(d.color);
|
|
493
|
+
}).attr('stroke-width', 1);
|
|
494
|
+
this.g.view.selectAll('path.data').transition().duration(150).style('opacity', function(d, i){
|
|
495
|
+
if (this$.legend.isSelected(d.bind.key)) {
|
|
496
|
+
return 1;
|
|
497
|
+
} else {
|
|
498
|
+
return 0.3;
|
|
377
499
|
}
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this.area.curve(this.cfg.line === 'curve'
|
|
385
|
-
? d3.curveCatmullRom
|
|
386
|
-
: d3.curveLinear);
|
|
387
|
-
this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
|
|
388
|
-
ref$ = [0, 0], miny = ref$[0], maxy = ref$[1];
|
|
389
|
-
for (i$ = 0, to$ = this.parsed.length; i$ < to$; ++i$) {
|
|
390
|
-
i = i$;
|
|
391
|
-
for (j$ = 0, to1$ = this.parsed[i].pts.length; j$ < to1$; ++j$) {
|
|
392
|
-
j = j$;
|
|
393
|
-
p = this.parsed[i].pts[j];
|
|
394
|
-
if (!isNaN(p.y0) && miny > p.y0) {
|
|
395
|
-
miny = p.y0;
|
|
396
|
-
}
|
|
397
|
-
if (!isNaN(p.y1) && miny > p.y1) {
|
|
398
|
-
miny = p.y1;
|
|
399
|
-
}
|
|
400
|
-
if (!isNaN(p.y0) && maxy < p.y0) {
|
|
401
|
-
maxy = p.y0;
|
|
402
|
-
}
|
|
403
|
-
if (!isNaN(p.y1) && maxy < p.y1) {
|
|
404
|
-
maxy = p.y1;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
500
|
+
}).attr('d', function(d, i){
|
|
501
|
+
var ref$;
|
|
502
|
+
if ((ref$ = this$.cfg.mode) === 'streamgraph' || ref$ === 'area') {
|
|
503
|
+
return this$.area(d.pts);
|
|
504
|
+
} else {
|
|
505
|
+
return this$.line(d.pts);
|
|
407
506
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.scale.x.domain(this.extent.x);
|
|
415
|
-
this.scale.y.domain(this.cfg.mode === 'bump'
|
|
416
|
-
? [this.extent.y[1], this.extent.y[0]]
|
|
417
|
-
: this.extent.y);
|
|
418
|
-
ref$ = [this.box.width, this.box.height], w = ref$[0], h = ref$[1];
|
|
419
|
-
maxTick = (ref$ = Math.ceil(this.layout.getBox('yaxis').height / 40)) > 2 ? ref$ : 2;
|
|
420
|
-
yticks = this.cfg.mode === 'bump'
|
|
421
|
-
? (function(){
|
|
422
|
-
var i$, to$, ref$, results$ = [];
|
|
423
|
-
for (i$ = 1, to$ = (ref$ = this.parsed.length || 1) > 1 ? ref$ : 1; i$ <= to$; ++i$) {
|
|
424
|
-
results$.push(i$);
|
|
425
|
-
}
|
|
426
|
-
return results$;
|
|
427
|
-
}.call(this))
|
|
428
|
-
: this.scale.y.ticks((ref$ = ((ref1$ = this.cfg).yaxis || (ref1$.yaxis = {})).tickCount || 4) < maxTick ? ref$ : maxTick);
|
|
429
|
-
yfmt = chart.utils.format.auto(yticks);
|
|
430
|
-
this.legend.config(this.cfg.legend);
|
|
431
|
-
this.legend.update();
|
|
432
|
-
this.yaxis.config(this.cfg.yaxis);
|
|
433
|
-
this.yaxis.ticks(yticks);
|
|
434
|
-
this.yaxis.scale(this.scale.y);
|
|
435
|
-
if (this.cfg.mode === 'bump') {
|
|
436
|
-
this.yaxis.caption(t('rank'));
|
|
507
|
+
}).attr('stroke', function(d, i){
|
|
508
|
+
return this$.tint.get(d.color);
|
|
509
|
+
}).attr('fill', function(d, i){
|
|
510
|
+
var ref$;
|
|
511
|
+
if ((ref$ = this$.cfg.mode) === 'streamgraph' || ref$ === 'area') {
|
|
512
|
+
return this$.tint.get(d.color);
|
|
437
513
|
} else {
|
|
438
|
-
|
|
439
|
-
units = Array.from(new Set(this.parsed.map(function(it){
|
|
440
|
-
return it.bind.unit;
|
|
441
|
-
}))).filter(function(it){
|
|
442
|
-
return it;
|
|
443
|
-
});
|
|
444
|
-
if (units.length > 1) {
|
|
445
|
-
this.yaxis.caption('');
|
|
446
|
-
} else {
|
|
447
|
-
this.yaxis.caption(units[0] || '');
|
|
448
|
-
}
|
|
449
|
-
} else {
|
|
450
|
-
v = (this.parsed[0] || {}).bind || {};
|
|
451
|
-
this.yaxis.caption((v.name || v.key || '') + (v.unit ? "(" + v.unit + ")" : ''));
|
|
452
|
-
}
|
|
514
|
+
return 'none';
|
|
453
515
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
r = this.cfg.dotSize || 3;
|
|
470
|
-
this.scale.x.range([0, w - r]);
|
|
471
|
-
this.scale.y.range([h, r]);
|
|
472
|
-
this.xaxis.render();
|
|
473
|
-
results$.push(this.yaxis.render());
|
|
516
|
+
}).attr('fill-opacity', function(){
|
|
517
|
+
return '0.5';
|
|
518
|
+
});
|
|
519
|
+
y$ = this.g.view.selectAll('g.dot').data(this.cfg.showDot
|
|
520
|
+
? this.parsed
|
|
521
|
+
: [], function(it){
|
|
522
|
+
return it.bind.key;
|
|
523
|
+
});
|
|
524
|
+
y$.exit().remove();
|
|
525
|
+
y$.enter().append('g').attr('class', 'dot');
|
|
526
|
+
this.g.view.selectAll('g.dot').style('opacity', function(d, i){
|
|
527
|
+
if (this$.legend.isSelected(d.bind.key)) {
|
|
528
|
+
return 1;
|
|
529
|
+
} else {
|
|
530
|
+
return 0.3;
|
|
474
531
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
var scale, tint, extent, r, vbox, lbox, x$, y$, this$ = this;
|
|
479
|
-
scale = this.scale, tint = this.tint, extent = this.extent;
|
|
480
|
-
r = this.cfg.dotSize || 3;
|
|
481
|
-
vbox = this.layout.getBox('view');
|
|
482
|
-
lbox = this.layout.getBox('yaxis');
|
|
483
|
-
x$ = this.g.view.selectAll('path.data').data(this.parsed, function(it){
|
|
484
|
-
return it.bind.key;
|
|
485
|
-
});
|
|
532
|
+
}).each(function(d, i){
|
|
533
|
+
var x$;
|
|
534
|
+
x$ = d3.select(this).selectAll('circle.dot').data(d.pts);
|
|
486
535
|
x$.exit().remove();
|
|
487
|
-
x$.enter().append('
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
536
|
+
x$.enter().append('circle').attr('class', 'dot').attr('r', r).attr('fill', '#fff').attr('stroke', tint.get(d.bind.name || d.bind.key));
|
|
537
|
+
d3.select(this).selectAll('circle.dot').filter(function(d, i){
|
|
538
|
+
return isNaN(d.y1);
|
|
539
|
+
}).attr('cx', function(d, i){
|
|
540
|
+
if (isNaN(scale.x(d.x))) {
|
|
541
|
+
return scale.x(extent.x[0]);
|
|
491
542
|
} else {
|
|
492
|
-
return this$.line(d.pts);
|
|
493
|
-
}
|
|
494
|
-
}).attr('stroke', function(d, i){
|
|
495
|
-
return this$.tint.get(d.color);
|
|
496
|
-
}).attr('stroke-width', 1);
|
|
497
|
-
this.g.view.selectAll('path.data').transition().duration(150).style('opacity', function(d, i){
|
|
498
|
-
if (this$.legend.isSelected(d.bind.key)) {
|
|
499
|
-
return 1;
|
|
500
|
-
} else {
|
|
501
|
-
return 0.3;
|
|
502
|
-
}
|
|
503
|
-
}).attr('d', function(d, i){
|
|
504
|
-
var ref$;
|
|
505
|
-
if ((ref$ = this$.cfg.mode) === 'streamgraph' || ref$ === 'area') {
|
|
506
|
-
return this$.area(d.pts);
|
|
507
|
-
} else {
|
|
508
|
-
return this$.line(d.pts);
|
|
509
|
-
}
|
|
510
|
-
}).attr('stroke', function(d, i){
|
|
511
|
-
return this$.tint.get(d.color);
|
|
512
|
-
}).attr('fill', function(d, i){
|
|
513
|
-
var ref$;
|
|
514
|
-
if ((ref$ = this$.cfg.mode) === 'streamgraph' || ref$ === 'area') {
|
|
515
|
-
return this$.tint.get(d.color);
|
|
516
|
-
} else {
|
|
517
|
-
return 'none';
|
|
518
|
-
}
|
|
519
|
-
}).attr('fill-opacity', function(){
|
|
520
|
-
return '0.5';
|
|
521
|
-
});
|
|
522
|
-
y$ = this.g.view.selectAll('g.dot').data(this.cfg.showDot
|
|
523
|
-
? this.parsed
|
|
524
|
-
: [], function(it){
|
|
525
|
-
return it.bind.key;
|
|
526
|
-
});
|
|
527
|
-
y$.exit().remove();
|
|
528
|
-
y$.enter().append('g').attr('class', 'dot');
|
|
529
|
-
this.g.view.selectAll('g.dot').style('opacity', function(d, i){
|
|
530
|
-
if (this$.legend.isSelected(d.bind.key)) {
|
|
531
|
-
return 1;
|
|
532
|
-
} else {
|
|
533
|
-
return 0.3;
|
|
534
|
-
}
|
|
535
|
-
}).each(function(d, i){
|
|
536
|
-
var x$;
|
|
537
|
-
x$ = d3.select(this).selectAll('circle.dot').data(d.pts);
|
|
538
|
-
x$.exit().remove();
|
|
539
|
-
x$.enter().append('circle').attr('class', 'dot').attr('r', r).attr('fill', '#fff').attr('stroke', tint.get(d.bind.name || d.bind.key));
|
|
540
|
-
d3.select(this).selectAll('circle.dot').filter(function(d, i){
|
|
541
|
-
return isNaN(d.y1);
|
|
542
|
-
}).attr('cx', function(d, i){
|
|
543
|
-
if (isNaN(scale.x(d.x))) {
|
|
544
|
-
return scale.x(extent.x[0]);
|
|
545
|
-
} else {
|
|
546
|
-
return scale.x(d.x);
|
|
547
|
-
}
|
|
548
|
-
}).attr('cy', function(d, i){
|
|
549
|
-
return scale.y(extent.y[0]);
|
|
550
|
-
}).transition(150).attr('opacity', 0);
|
|
551
|
-
return d3.select(this).selectAll('circle.dot').filter(function(d, i){
|
|
552
|
-
return !isNaN(d.y1);
|
|
553
|
-
}).attr('cx', function(d, i){
|
|
554
543
|
return scale.x(d.x);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
});
|
|
559
|
-
this.
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
544
|
+
}
|
|
545
|
+
}).attr('cy', function(d, i){
|
|
546
|
+
return scale.y(extent.y[0]);
|
|
547
|
+
}).transition(150).attr('opacity', 0);
|
|
548
|
+
return d3.select(this).selectAll('circle.dot').filter(function(d, i){
|
|
549
|
+
return !isNaN(d.y1);
|
|
550
|
+
}).attr('cx', function(d, i){
|
|
551
|
+
return scale.x(d.x);
|
|
552
|
+
}).attr('cy', function(d, i){
|
|
553
|
+
return scale.y(d.y1);
|
|
554
|
+
}).attr('r', r).attr('fill', tint.get(d.color)).attr('stroke', tint.get(d.color)).transition(150).attr('opacity', 1);
|
|
555
|
+
});
|
|
556
|
+
this.legend.render();
|
|
557
|
+
this.xaxis.render();
|
|
558
|
+
return this.yaxis.render();
|
|
559
|
+
}
|
|
564
560
|
};
|
|
565
|
-
|
|
566
|
-
});
|
|
561
|
+
};
|
|
567
562
|
function import$(obj, src){
|
|
568
563
|
var own = {}.hasOwnProperty;
|
|
569
564
|
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|