@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
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Logs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## v1.0.1
|
|
4
|
+
|
|
5
|
+
- dont `postinstall npx fedep` since it may lead to installation failure.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v1.0.0
|
|
9
|
+
|
|
10
|
+
- adopt `@plotdb/block` v4 syntax
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## v0.0.3
|
|
4
14
|
|
|
5
15
|
- upgrade @plotdb/block and related modules. add @loadingio/vscroll
|
|
6
16
|
- support Promise-based sample function
|
package/build
CHANGED
|
@@ -8,11 +8,11 @@ echo "building livescript files ... "
|
|
|
8
8
|
./node_modules/.bin/lsc -c --no-header -o dist src
|
|
9
9
|
|
|
10
10
|
echo "building stylus files ... "
|
|
11
|
-
./node_modules/.bin/stylus -p src/
|
|
11
|
+
./node_modules/.bin/stylus -p src/index.styl > dist/index.css
|
|
12
12
|
./node_modules/.bin/stylus -p src/utils/legend.styl > dist/utils/legend.css
|
|
13
13
|
|
|
14
|
-
echo "minify
|
|
15
|
-
./node_modules/.bin/uglifyjs dist/
|
|
14
|
+
echo "minify index.js -> index.min.js ..."
|
|
15
|
+
./node_modules/.bin/uglifyjs dist/index.js > dist/index.min.js
|
|
16
16
|
echo "minify src/utils/legend.js -> dist/utils/legend.min.js ..."
|
|
17
17
|
./node_modules/.bin/uglifyjs dist/utils/legend.js > dist/utils/legend.min.js
|
|
18
18
|
echo "minify src/utils/tint.js -> dist/utils/tint.min.js ..."
|
|
@@ -28,11 +28,17 @@ echo "minify src/utils/tip.js -> dist/utils/tip.min.js ..."
|
|
|
28
28
|
echo "minify src/utils/config.js -> dist/utils/config.min.js ..."
|
|
29
29
|
./node_modules/.bin/uglifyjs dist/utils/config.js > dist/utils/config.min.js
|
|
30
30
|
|
|
31
|
-
echo "minifying dist/
|
|
32
|
-
./node_modules/.bin/uglifycss dist/
|
|
31
|
+
echo "minifying dist/index.css ..."
|
|
32
|
+
./node_modules/.bin/uglifycss dist/index.css > dist/index.min.css
|
|
33
33
|
echo "minifying dist/utils/legend.css ..."
|
|
34
34
|
./node_modules/.bin/uglifycss dist/utils/legend.css > dist/utils/legend.min.css
|
|
35
35
|
|
|
36
|
+
echo "legacy chart.css / chart.js ..."
|
|
37
|
+
cp dist/index.js dist/chart.js
|
|
38
|
+
cp dist/index.min.js dist/chart.min.js
|
|
39
|
+
cp dist/index.css dist/chart.css
|
|
40
|
+
cp dist/index.min.css dist/chart.min.css
|
|
41
|
+
|
|
36
42
|
echo "copy dist to web ..."
|
|
37
43
|
rm -rf "web/static/assets/lib/@plotdb/chart/main/"
|
|
38
44
|
mkdir -p "web/static/assets/lib/@plotdb/chart/main/"
|
package/dist/index.css
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
(function(){
|
|
2
|
+
var svgns, parent, aniloop, visibilityObserver, resizeObserver, withDefault, defaultConfig, chart;
|
|
3
|
+
svgns = "http://www.w3.org/2000/svg";
|
|
4
|
+
parent = function(n, s, e){
|
|
5
|
+
var m;
|
|
6
|
+
m = n;
|
|
7
|
+
while (n && n !== e) {
|
|
8
|
+
n = n.parentNode;
|
|
9
|
+
}
|
|
10
|
+
if (n !== e) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (!s) {
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
n = m;
|
|
17
|
+
while (n && n !== e && (!n.matches || (n.matches && !n.matches(s)))) {
|
|
18
|
+
n = n.parentNode;
|
|
19
|
+
}
|
|
20
|
+
if (n === e && (!e.matches || !e.matches(s))) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return n;
|
|
24
|
+
};
|
|
25
|
+
aniloop = function(){
|
|
26
|
+
this.running = false;
|
|
27
|
+
this.time = {
|
|
28
|
+
now: 0,
|
|
29
|
+
last: 0
|
|
30
|
+
};
|
|
31
|
+
this.fps(60);
|
|
32
|
+
this.evtHandler = {};
|
|
33
|
+
return this;
|
|
34
|
+
};
|
|
35
|
+
aniloop.prototype = import$(Object.create(Object.prototype), {
|
|
36
|
+
on: function(n, cb){
|
|
37
|
+
var this$ = this;
|
|
38
|
+
return (Array.isArray(n)
|
|
39
|
+
? n
|
|
40
|
+
: [n]).map(function(n){
|
|
41
|
+
var ref$;
|
|
42
|
+
return ((ref$ = this$.evtHandler)[n] || (ref$[n] = [])).push(cb);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
fire: function(n){
|
|
46
|
+
var v, res$, i$, to$, ref$, len$, cb, results$ = [];
|
|
47
|
+
res$ = [];
|
|
48
|
+
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
49
|
+
res$.push(arguments[i$]);
|
|
50
|
+
}
|
|
51
|
+
v = res$;
|
|
52
|
+
for (i$ = 0, len$ = (ref$ = this.evtHandler[n] || []).length; i$ < len$; ++i$) {
|
|
53
|
+
cb = ref$[i$];
|
|
54
|
+
results$.push(cb.apply(this, v));
|
|
55
|
+
}
|
|
56
|
+
return results$;
|
|
57
|
+
},
|
|
58
|
+
reset: function(){
|
|
59
|
+
return this.time = {
|
|
60
|
+
now: 0
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
setTime: function(t){
|
|
64
|
+
return this.time.now = t;
|
|
65
|
+
},
|
|
66
|
+
getTime: function(){
|
|
67
|
+
return this.time.now;
|
|
68
|
+
},
|
|
69
|
+
isRunning: function(){
|
|
70
|
+
return this.running;
|
|
71
|
+
},
|
|
72
|
+
toggle: function(it){
|
|
73
|
+
if (it != null) {
|
|
74
|
+
this.running = !it;
|
|
75
|
+
}
|
|
76
|
+
if (this.running) {
|
|
77
|
+
return this.pause();
|
|
78
|
+
} else {
|
|
79
|
+
return this.run();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
pause: function(){
|
|
83
|
+
return this.running = false;
|
|
84
|
+
},
|
|
85
|
+
render: function(){
|
|
86
|
+
return this.fire('tick', this.time.now);
|
|
87
|
+
},
|
|
88
|
+
run: function(fps){
|
|
89
|
+
var this$ = this;
|
|
90
|
+
if (fps != null) {
|
|
91
|
+
this.fps(fps);
|
|
92
|
+
}
|
|
93
|
+
if (this.running) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.running = true;
|
|
97
|
+
return requestAnimationFrame(function(t){
|
|
98
|
+
return this$.handler(this$.time.last = t, true);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
throttle: function(v){
|
|
102
|
+
v == null && (v = true);
|
|
103
|
+
return this.isThrottled = v;
|
|
104
|
+
},
|
|
105
|
+
fps: function(it){
|
|
106
|
+
if (!(it != null)) {
|
|
107
|
+
return this._fps_val;
|
|
108
|
+
}
|
|
109
|
+
this._fps_val = it > 0.01 ? it : 0.01;
|
|
110
|
+
return this._fps_delay = 1000 / this._fps_val;
|
|
111
|
+
},
|
|
112
|
+
handler: function(t, force){
|
|
113
|
+
var delay, ref$, this$ = this;
|
|
114
|
+
force == null && (force = false);
|
|
115
|
+
if (!this.running) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.time.now = t;
|
|
119
|
+
delay = this.isThrottled
|
|
120
|
+
? (ref$ = this._fps_delay) > 1000 ? ref$ : 1000
|
|
121
|
+
: this._fps_delay;
|
|
122
|
+
if (force || this.time.now - this.time.last >= delay) {
|
|
123
|
+
this.time.last = t;
|
|
124
|
+
this.render();
|
|
125
|
+
}
|
|
126
|
+
return requestAnimationFrame(function(t){
|
|
127
|
+
return this$.handler(t, false);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
visibilityObserver = {
|
|
132
|
+
list: [],
|
|
133
|
+
init: function(){
|
|
134
|
+
var ref$, h, vc, this$ = this;
|
|
135
|
+
this.inited = true;
|
|
136
|
+
ref$ = document.hidden != null
|
|
137
|
+
? ['hidden', 'visibilitychange']
|
|
138
|
+
: document.msHidden != null
|
|
139
|
+
? ['hidden', 'visibilitychange']
|
|
140
|
+
: document.webkiHidden != null
|
|
141
|
+
? ['webkitHidden', 'webkitvisibilitychange']
|
|
142
|
+
: ['hidden', 'visibilitychange'], h = ref$[0], vc = ref$[1];
|
|
143
|
+
return document.addEventListener(vc, debounce(150, function(){
|
|
144
|
+
var th;
|
|
145
|
+
th = !!document[h];
|
|
146
|
+
return this$.list.map(function(it){
|
|
147
|
+
return it.throttle(th);
|
|
148
|
+
});
|
|
149
|
+
}, false));
|
|
150
|
+
},
|
|
151
|
+
add: function(aniloop){
|
|
152
|
+
if (!this.inited) {
|
|
153
|
+
this.init();
|
|
154
|
+
}
|
|
155
|
+
return this.list.push(aniloop);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
resizeObserver = {
|
|
159
|
+
wm: new WeakMap(),
|
|
160
|
+
ro: new ResizeObserver(function(list){
|
|
161
|
+
return list.map(function(n){
|
|
162
|
+
var ret;
|
|
163
|
+
ret = resizeObserver.wm.get(n.target);
|
|
164
|
+
return ret._resize();
|
|
165
|
+
});
|
|
166
|
+
}),
|
|
167
|
+
add: function(node, obj){
|
|
168
|
+
this.wm.set(node, obj);
|
|
169
|
+
return this.ro.observe(node);
|
|
170
|
+
},
|
|
171
|
+
'delete': function(it){
|
|
172
|
+
this.ro.unobserve(it);
|
|
173
|
+
return this.wm['delete'](it);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
withDefault = function(cfg, defcfg){
|
|
177
|
+
var _;
|
|
178
|
+
cfg == null && (cfg = {});
|
|
179
|
+
defcfg == null && (defcfg = {});
|
|
180
|
+
defcfg = JSON.parse(JSON.stringify(defcfg));
|
|
181
|
+
_ = function(cfg, defcfg){
|
|
182
|
+
var k, v;
|
|
183
|
+
for (k in defcfg) {
|
|
184
|
+
v = defcfg[k];
|
|
185
|
+
if (!(cfg[k] != null)) {
|
|
186
|
+
cfg[k] = v;
|
|
187
|
+
} else if (typeof cfg[k] === 'object' && typeof v === 'object') {
|
|
188
|
+
withDefault(cfg[k], defcfg[k]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return cfg;
|
|
192
|
+
};
|
|
193
|
+
return _(cfg, defcfg);
|
|
194
|
+
};
|
|
195
|
+
defaultConfig = function(cfg){
|
|
196
|
+
var _;
|
|
197
|
+
_ = function(meta, ret){
|
|
198
|
+
var ctrls, that, id, v;
|
|
199
|
+
ret == null && (ret = {});
|
|
200
|
+
ctrls = (that = meta.child) ? that : meta;
|
|
201
|
+
for (id in meta) {
|
|
202
|
+
v = meta[id];
|
|
203
|
+
if (!v.type) {
|
|
204
|
+
_(v, ret[id] || (ret[id] = {}));
|
|
205
|
+
} else if (v['default']) {
|
|
206
|
+
ret[id] = v['default'];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return ret;
|
|
210
|
+
};
|
|
211
|
+
return _(cfg);
|
|
212
|
+
};
|
|
213
|
+
chart = function(opt){
|
|
214
|
+
var this$ = this;
|
|
215
|
+
opt == null && (opt = {});
|
|
216
|
+
this.root = typeof opt.root === 'string'
|
|
217
|
+
? document.querySelector(opt.root)
|
|
218
|
+
: opt.root;
|
|
219
|
+
this.useSample = opt.useSample != null ? opt.useSample : true;
|
|
220
|
+
this.autoSelect = opt.autoSelect != null ? opt.autoSelect : true;
|
|
221
|
+
this.forceInit = opt.forceInit ? opt.forceInit : false;
|
|
222
|
+
this.prepareSvg = opt.prepareSvg != null ? opt.prepareSvg : true;
|
|
223
|
+
this.layoutOpt = opt.layout != null ? opt.layout : true;
|
|
224
|
+
this.delayRender = opt.delayRender || false;
|
|
225
|
+
this.dataAccessor = opt.dataAccessor != null
|
|
226
|
+
? opt.dataAccessor
|
|
227
|
+
: function(it){
|
|
228
|
+
if (it) {
|
|
229
|
+
return it.data._raw;
|
|
230
|
+
} else {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
this.raw = opt.raw || null;
|
|
235
|
+
this.mod = opt.mod || {};
|
|
236
|
+
this.cfg = opt.config || {};
|
|
237
|
+
this.seed = opt.seed || Math.random();
|
|
238
|
+
this.binding = opt.binding || {};
|
|
239
|
+
this.evtHandler = {};
|
|
240
|
+
this.init = proxise.once(function(){
|
|
241
|
+
return this$._init();
|
|
242
|
+
});
|
|
243
|
+
this._resize = null;
|
|
244
|
+
if (this.autoSelect) {
|
|
245
|
+
this.root.addEventListener('click', this._select = function(e){
|
|
246
|
+
var p;
|
|
247
|
+
if (!(p = parent(e.target, '.data', this$.root))) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
return this$.fire('select', [{
|
|
251
|
+
data: this$.dataAccessor(p),
|
|
252
|
+
node: p
|
|
253
|
+
}]);
|
|
254
|
+
});
|
|
255
|
+
this.root.addEventListener('mouseover', this._hover = function(e){
|
|
256
|
+
var p;
|
|
257
|
+
if (!(p = ld$.parent(e.target, '.data', this$.root))) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
return this$.fire('hover', [{
|
|
261
|
+
data: this$.dataAccessor(p),
|
|
262
|
+
node: p
|
|
263
|
+
}]);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return this;
|
|
267
|
+
};
|
|
268
|
+
chart.prototype = import$(Object.create(Object.prototype), {
|
|
269
|
+
_init: function(){
|
|
270
|
+
var layoutRoot, ref$, r, p, this$ = this;
|
|
271
|
+
if (window.getComputedStyle(this.root).position === 'static') {
|
|
272
|
+
this.root.style.position = 'relative';
|
|
273
|
+
}
|
|
274
|
+
layoutRoot = this.layoutOpt ? typeof this.layoutOpt !== 'object'
|
|
275
|
+
? this.root.querySelector('.pdl-layout')
|
|
276
|
+
: typeof this.layoutOpt.root === 'string'
|
|
277
|
+
? this.root.querySelector(this.layoutOpt.root)
|
|
278
|
+
: this.layoutOpt.root ? this.layoutOpt.root : null : null;
|
|
279
|
+
if (this.prepareSvg && !(this.svg = this.root.querySelector('svg'))) {
|
|
280
|
+
this.svg = document.createElementNS(svgns, "svg");
|
|
281
|
+
ref$ = this.svg.style;
|
|
282
|
+
ref$.width = "100%";
|
|
283
|
+
ref$.height = "100%";
|
|
284
|
+
if (this.layoutOpt) {
|
|
285
|
+
if (!layoutRoot) {
|
|
286
|
+
console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. ");
|
|
287
|
+
}
|
|
288
|
+
r = layoutRoot.querySelector('[data-type=render]');
|
|
289
|
+
if (!r) {
|
|
290
|
+
console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root.");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
(r || this.root).appendChild(this.svg);
|
|
294
|
+
}
|
|
295
|
+
this._aniloop = new aniloop();
|
|
296
|
+
visibilityObserver.add(this._aniloop);
|
|
297
|
+
this._aniloop.on('tick', function(){
|
|
298
|
+
return this$.tick();
|
|
299
|
+
});
|
|
300
|
+
return p = Promise.resolve().then(function(){
|
|
301
|
+
var defcfg, ret;
|
|
302
|
+
defcfg = defaultConfig(this$.mod.config || {});
|
|
303
|
+
withDefault(this$.cfg, defcfg);
|
|
304
|
+
if (this$.raw && Array.isArray(this$.raw)) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (!this$.useSample || !this$.mod.sample) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
ret = this$.mod.sample.apply(this$);
|
|
311
|
+
return ret.then
|
|
312
|
+
? ret.then()
|
|
313
|
+
: Promise.resolve(ret);
|
|
314
|
+
}).then(function(it){
|
|
315
|
+
var ref$;
|
|
316
|
+
return this$.raw = (ref$ = it || {}).raw, this$.binding = ref$.binding, this$;
|
|
317
|
+
}).then(function(){
|
|
318
|
+
var ref$, _resizeLock;
|
|
319
|
+
if (!this$.raw) {
|
|
320
|
+
this$.raw = [];
|
|
321
|
+
}
|
|
322
|
+
if (this$.layoutOpt) {
|
|
323
|
+
if (!(typeof layout != 'undefined' && layout !== null)) {
|
|
324
|
+
console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found.");
|
|
325
|
+
} else {
|
|
326
|
+
if (!layoutRoot) {
|
|
327
|
+
console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout.");
|
|
328
|
+
console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false");
|
|
329
|
+
}
|
|
330
|
+
this$.layout = new layout(typeof this$.layoutOpt === 'object'
|
|
331
|
+
? (ref$ = import$({}, this$.layoutOpt), ref$.watchResize = false, ref$)
|
|
332
|
+
: {
|
|
333
|
+
root: layoutRoot,
|
|
334
|
+
watchResize: false
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
_resizeLock = proxise(function(){
|
|
339
|
+
resizeObserver.add(this$.root, this$);
|
|
340
|
+
return null;
|
|
341
|
+
});
|
|
342
|
+
if (this$.forceInit && !this$.root.offsetParent || window.getComputedStyle(this$.root).display === 'none') {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
this$._resize = function(){
|
|
346
|
+
return _resizeLock.resolve();
|
|
347
|
+
};
|
|
348
|
+
return _resizeLock();
|
|
349
|
+
}).then(function(){
|
|
350
|
+
return this$._resize = function(){};
|
|
351
|
+
}).then(function(){
|
|
352
|
+
var init, layoutLock;
|
|
353
|
+
init = function(){
|
|
354
|
+
if (this$.mod.init) {
|
|
355
|
+
return this$.mod.init.apply(this$);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
if (!this$.layout) {
|
|
359
|
+
return init();
|
|
360
|
+
}
|
|
361
|
+
layoutLock = proxise(function(){
|
|
362
|
+
Promise.resolve(this$.layout.init(init));
|
|
363
|
+
return null;
|
|
364
|
+
});
|
|
365
|
+
this$._layout = function(){
|
|
366
|
+
return layoutLock.resolve();
|
|
367
|
+
};
|
|
368
|
+
this$.layout.on('render', function(){
|
|
369
|
+
return this$._layout();
|
|
370
|
+
});
|
|
371
|
+
return layoutLock();
|
|
372
|
+
}).then(function(){
|
|
373
|
+
this$._layout = function(){};
|
|
374
|
+
Promise.resolve().then(function(){
|
|
375
|
+
if (!this$.delayRender) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
this$.renderLock = proxise(function(){});
|
|
379
|
+
return this$.renderLock();
|
|
380
|
+
}).then(function(){
|
|
381
|
+
this$._resize = function(){
|
|
382
|
+
this$.resize();
|
|
383
|
+
return this$.render();
|
|
384
|
+
};
|
|
385
|
+
this$._layout = function(){
|
|
386
|
+
this$.parse();
|
|
387
|
+
this$.bind();
|
|
388
|
+
this$.resize();
|
|
389
|
+
return this$.render();
|
|
390
|
+
};
|
|
391
|
+
this$.parse();
|
|
392
|
+
this$.bind();
|
|
393
|
+
this$.resize();
|
|
394
|
+
return this$.render();
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
},
|
|
398
|
+
parse: function(){
|
|
399
|
+
var this$ = this;
|
|
400
|
+
this.data = this.raw.map(function(r, i){
|
|
401
|
+
var ret, k, v;
|
|
402
|
+
ret = {};
|
|
403
|
+
(function(){
|
|
404
|
+
var ref$, results$ = [];
|
|
405
|
+
for (k in ref$ = this.binding) {
|
|
406
|
+
v = ref$[k];
|
|
407
|
+
results$.push({
|
|
408
|
+
k: k,
|
|
409
|
+
v: v
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
return results$;
|
|
413
|
+
}.call(this$)).map(function(arg$){
|
|
414
|
+
var k, v, ref$, ref1$, t;
|
|
415
|
+
k = arg$.k, v = arg$.v;
|
|
416
|
+
if (!v) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
ret[k] = ((ref$ = (ref1$ = this$.mod).dimension || (ref1$.dimension = {}))[k] || (ref$[k] = {})).multiple
|
|
420
|
+
? v.map(function(it){
|
|
421
|
+
return r[it.key];
|
|
422
|
+
})
|
|
423
|
+
: r[v.key];
|
|
424
|
+
t = ((ref$ = (ref1$ = this$.mod).dimension || (ref1$.dimension = {}))[k] || (ref$[k] = {})).type;
|
|
425
|
+
if (/[RIT]/.exec(t) && !/[CN]/.exec(t)) {
|
|
426
|
+
return ret[k] = Array.isArray(ret[k])
|
|
427
|
+
? ret[k].map(function(it){
|
|
428
|
+
return parseFloat(it);
|
|
429
|
+
})
|
|
430
|
+
: parseFloat(ret[k]);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
ret._raw = r;
|
|
434
|
+
ret._idx = i;
|
|
435
|
+
return ret;
|
|
436
|
+
});
|
|
437
|
+
if (this.mod.parse) {
|
|
438
|
+
return this.mod.parse.apply(this);
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
bind: function(){
|
|
442
|
+
if (this.mod.bind) {
|
|
443
|
+
return this.mod.bind.apply(this);
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
start: function(){
|
|
447
|
+
this._aniloop.run();
|
|
448
|
+
if (this.mod.start) {
|
|
449
|
+
return this.mod.start.apply(this);
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
stop: function(){
|
|
453
|
+
this._aniloop.pause();
|
|
454
|
+
if (this.mod.stop) {
|
|
455
|
+
return this.mod.stop.apply(this);
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
resize: function(){
|
|
459
|
+
if (this.layout) {
|
|
460
|
+
this.layout.update(false);
|
|
461
|
+
}
|
|
462
|
+
this.box = this.root.getBoundingClientRect();
|
|
463
|
+
if (this.mod.resize) {
|
|
464
|
+
return this.mod.resize.apply(this);
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
tick: function(){
|
|
468
|
+
if (this.mod.tick) {
|
|
469
|
+
return this.mod.tick.apply(this);
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
render: function(){
|
|
473
|
+
if (this.mod.render) {
|
|
474
|
+
return this.mod.render.apply(this);
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
destroy: function(){
|
|
478
|
+
var this$ = this;
|
|
479
|
+
return Promise.resolve().then(function(){
|
|
480
|
+
if (this$._select) {
|
|
481
|
+
this$.root.removeEventListener('click', this$._select);
|
|
482
|
+
}
|
|
483
|
+
if (this$._hover) {
|
|
484
|
+
this$.root.removeEventListener('mouseover', this$._hover);
|
|
485
|
+
}
|
|
486
|
+
resizeObserver['delete'](this$.root);
|
|
487
|
+
if (this$.layout) {
|
|
488
|
+
this$.layout.destroy();
|
|
489
|
+
}
|
|
490
|
+
this$.stop();
|
|
491
|
+
if (this$.mod.destroy) {
|
|
492
|
+
return this$.mod.destroy.apply(this$);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
},
|
|
496
|
+
config: function(opt){
|
|
497
|
+
if (!(opt != null && opt)) {
|
|
498
|
+
return this.cfg;
|
|
499
|
+
}
|
|
500
|
+
return import$(this.cfg, opt);
|
|
501
|
+
},
|
|
502
|
+
setBind: function(n, b){
|
|
503
|
+
this.binding[n] = b;
|
|
504
|
+
this.parse();
|
|
505
|
+
this.bind();
|
|
506
|
+
this.resize();
|
|
507
|
+
return this.render();
|
|
508
|
+
},
|
|
509
|
+
setRaw: function(raw, binding, reinit){
|
|
510
|
+
var ref$;
|
|
511
|
+
reinit == null && (reinit = false);
|
|
512
|
+
if (!Array.isArray(raw)) {
|
|
513
|
+
ref$ = raw, raw = ref$.raw, binding = ref$.binding, reinit = ref$.reinit;
|
|
514
|
+
}
|
|
515
|
+
if (raw != null) {
|
|
516
|
+
this.raw = raw;
|
|
517
|
+
}
|
|
518
|
+
if (binding != null) {
|
|
519
|
+
this.binding = binding;
|
|
520
|
+
}
|
|
521
|
+
if (this.renderLock) {
|
|
522
|
+
this.renderLock.resolve();
|
|
523
|
+
return this.renderLock = null;
|
|
524
|
+
} else {
|
|
525
|
+
if (reinit && this.mod.init) {
|
|
526
|
+
this.mod.init.apply(this);
|
|
527
|
+
}
|
|
528
|
+
this.parse();
|
|
529
|
+
this.bind();
|
|
530
|
+
this.resize();
|
|
531
|
+
return this.render();
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
on: function(n, cb){
|
|
535
|
+
var this$ = this;
|
|
536
|
+
return (Array.isArray(n)
|
|
537
|
+
? n
|
|
538
|
+
: [n]).map(function(n){
|
|
539
|
+
var ref$;
|
|
540
|
+
return ((ref$ = this$.evtHandler)[n] || (ref$[n] = [])).push(cb);
|
|
541
|
+
});
|
|
542
|
+
},
|
|
543
|
+
fire: function(n){
|
|
544
|
+
var v, res$, i$, to$, ref$, len$, cb, results$ = [];
|
|
545
|
+
res$ = [];
|
|
546
|
+
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
547
|
+
res$.push(arguments[i$]);
|
|
548
|
+
}
|
|
549
|
+
v = res$;
|
|
550
|
+
for (i$ = 0, len$ = (ref$ = this.evtHandler[n] || []).length; i$ < len$; ++i$) {
|
|
551
|
+
cb = ref$[i$];
|
|
552
|
+
results$.push(cb.apply(this, v));
|
|
553
|
+
}
|
|
554
|
+
return results$;
|
|
555
|
+
},
|
|
556
|
+
filter: function(filters, internal){
|
|
557
|
+
var bs, k, ref$, v, u;
|
|
558
|
+
filters == null && (filters = {});
|
|
559
|
+
internal == null && (internal = false);
|
|
560
|
+
bs = [];
|
|
561
|
+
for (k in ref$ = this.binding) {
|
|
562
|
+
v = ref$[k];
|
|
563
|
+
u = Array.isArray(v)
|
|
564
|
+
? v
|
|
565
|
+
: [v];
|
|
566
|
+
u = u.map(fn$);
|
|
567
|
+
bs = bs.concat(u);
|
|
568
|
+
}
|
|
569
|
+
for (k in filters) {
|
|
570
|
+
v = filters[k];
|
|
571
|
+
bs.filter(fn1$).map(fn2$);
|
|
572
|
+
}
|
|
573
|
+
if (internal) {
|
|
574
|
+
this.fire('filter', filters);
|
|
575
|
+
}
|
|
576
|
+
if (this.mod.filter) {
|
|
577
|
+
this.mod.filter.apply(this, [filters, internal]);
|
|
578
|
+
}
|
|
579
|
+
this.parse();
|
|
580
|
+
this.bind();
|
|
581
|
+
this.resize();
|
|
582
|
+
return this.render();
|
|
583
|
+
function fn$(v){
|
|
584
|
+
return {
|
|
585
|
+
k: k,
|
|
586
|
+
v: v
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function fn1$(it){
|
|
590
|
+
return it.k === k;
|
|
591
|
+
}
|
|
592
|
+
function fn2$(it){
|
|
593
|
+
return it.v.filter = v;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
if (typeof module != 'undefined' && module !== null) {
|
|
598
|
+
module.exports = chart;
|
|
599
|
+
} else if (typeof window != 'undefined' && window !== null) {
|
|
600
|
+
window.chart = chart;
|
|
601
|
+
}
|
|
602
|
+
function import$(obj, src){
|
|
603
|
+
var own = {}.hasOwnProperty;
|
|
604
|
+
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
|
605
|
+
return obj;
|
|
606
|
+
}
|
|
607
|
+
}).call(this);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
div[plug=layout]{width:100%;height:100%}div[plug=layout] .pdl-layout{width:100%;height:100%}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var svgns,parent,aniloop,visibilityObserver,resizeObserver,withDefault,defaultConfig,chart;svgns="http://www.w3.org/2000/svg";parent=function(n,s,e){var m;m=n;while(n&&n!==e){n=n.parentNode}if(n!==e){return null}if(!s){return n}n=m;while(n&&n!==e&&(!n.matches||n.matches&&!n.matches(s))){n=n.parentNode}if(n===e&&(!e.matches||!e.matches(s))){return null}return n};aniloop=function(){this.running=false;this.time={now:0,last:0};this.fps(60);this.evtHandler={};return this};aniloop.prototype=import$(Object.create(Object.prototype),{on:function(n,cb){var this$=this;return(Array.isArray(n)?n:[n]).map(function(n){var ref$;return((ref$=this$.evtHandler)[n]||(ref$[n]=[])).push(cb)})},fire:function(n){var v,res$,i$,to$,ref$,len$,cb,results$=[];res$=[];for(i$=1,to$=arguments.length;i$<to$;++i$){res$.push(arguments[i$])}v=res$;for(i$=0,len$=(ref$=this.evtHandler[n]||[]).length;i$<len$;++i$){cb=ref$[i$];results$.push(cb.apply(this,v))}return results$},reset:function(){return this.time={now:0}},setTime:function(t){return this.time.now=t},getTime:function(){return this.time.now},isRunning:function(){return this.running},toggle:function(it){if(it!=null){this.running=!it}if(this.running){return this.pause()}else{return this.run()}},pause:function(){return this.running=false},render:function(){return this.fire("tick",this.time.now)},run:function(fps){var this$=this;if(fps!=null){this.fps(fps)}if(this.running){return}this.running=true;return requestAnimationFrame(function(t){return this$.handler(this$.time.last=t,true)})},throttle:function(v){v==null&&(v=true);return this.isThrottled=v},fps:function(it){if(!(it!=null)){return this._fps_val}this._fps_val=it>.01?it:.01;return this._fps_delay=1e3/this._fps_val},handler:function(t,force){var delay,ref$,this$=this;force==null&&(force=false);if(!this.running){return}this.time.now=t;delay=this.isThrottled?(ref$=this._fps_delay)>1e3?ref$:1e3:this._fps_delay;if(force||this.time.now-this.time.last>=delay){this.time.last=t;this.render()}return requestAnimationFrame(function(t){return this$.handler(t,false)})}});visibilityObserver={list:[],init:function(){var ref$,h,vc,this$=this;this.inited=true;ref$=document.hidden!=null?["hidden","visibilitychange"]:document.msHidden!=null?["hidden","visibilitychange"]:document.webkiHidden!=null?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],h=ref$[0],vc=ref$[1];return document.addEventListener(vc,debounce(150,function(){var th;th=!!document[h];return this$.list.map(function(it){return it.throttle(th)})},false))},add:function(aniloop){if(!this.inited){this.init()}return this.list.push(aniloop)}};resizeObserver={wm:new WeakMap,ro:new ResizeObserver(function(list){return list.map(function(n){var ret;ret=resizeObserver.wm.get(n.target);return ret._resize()})}),add:function(node,obj){this.wm.set(node,obj);return this.ro.observe(node)},delete:function(it){this.ro.unobserve(it);return this.wm["delete"](it)}};withDefault=function(cfg,defcfg){var _;cfg==null&&(cfg={});defcfg==null&&(defcfg={});defcfg=JSON.parse(JSON.stringify(defcfg));_=function(cfg,defcfg){var k,v;for(k in defcfg){v=defcfg[k];if(!(cfg[k]!=null)){cfg[k]=v}else if(typeof cfg[k]==="object"&&typeof v==="object"){withDefault(cfg[k],defcfg[k])}}return cfg};return _(cfg,defcfg)};defaultConfig=function(cfg){var _;_=function(meta,ret){var ctrls,that,id,v;ret==null&&(ret={});ctrls=(that=meta.child)?that:meta;for(id in meta){v=meta[id];if(!v.type){_(v,ret[id]||(ret[id]={}))}else if(v["default"]){ret[id]=v["default"]}}return ret};return _(cfg)};chart=function(opt){var this$=this;opt==null&&(opt={});this.root=typeof opt.root==="string"?document.querySelector(opt.root):opt.root;this.useSample=opt.useSample!=null?opt.useSample:true;this.autoSelect=opt.autoSelect!=null?opt.autoSelect:true;this.forceInit=opt.forceInit?opt.forceInit:false;this.prepareSvg=opt.prepareSvg!=null?opt.prepareSvg:true;this.layoutOpt=opt.layout!=null?opt.layout:true;this.delayRender=opt.delayRender||false;this.dataAccessor=opt.dataAccessor!=null?opt.dataAccessor:function(it){if(it){return it.data._raw}else{return null}};this.raw=opt.raw||null;this.mod=opt.mod||{};this.cfg=opt.config||{};this.seed=opt.seed||Math.random();this.binding=opt.binding||{};this.evtHandler={};this.init=proxise.once(function(){return this$._init()});this._resize=null;if(this.autoSelect){this.root.addEventListener("click",this._select=function(e){var p;if(!(p=parent(e.target,".data",this$.root))){return}return this$.fire("select",[{data:this$.dataAccessor(p),node:p}])});this.root.addEventListener("mouseover",this._hover=function(e){var p;if(!(p=ld$.parent(e.target,".data",this$.root))){return}return this$.fire("hover",[{data:this$.dataAccessor(p),node:p}])})}return this};chart.prototype=import$(Object.create(Object.prototype),{_init:function(){var layoutRoot,ref$,r,p,this$=this;if(window.getComputedStyle(this.root).position==="static"){this.root.style.position="relative"}layoutRoot=this.layoutOpt?typeof this.layoutOpt!=="object"?this.root.querySelector(".pdl-layout"):typeof this.layoutOpt.root==="string"?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root?this.layoutOpt.root:null:null;if(this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))){this.svg=document.createElementNS(svgns,"svg");ref$=this.svg.style;ref$.width="100%";ref$.height="100%";if(this.layoutOpt){if(!layoutRoot){console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. ")}r=layoutRoot.querySelector("[data-type=render]");if(!r){console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root.")}}(r||this.root).appendChild(this.svg)}this._aniloop=new aniloop;visibilityObserver.add(this._aniloop);this._aniloop.on("tick",function(){return this$.tick()});return p=Promise.resolve().then(function(){var defcfg,ret;defcfg=defaultConfig(this$.mod.config||{});withDefault(this$.cfg,defcfg);if(this$.raw&&Array.isArray(this$.raw)){return}if(!this$.useSample||!this$.mod.sample){return}ret=this$.mod.sample.apply(this$);return ret.then?ret.then():Promise.resolve(ret)}).then(function(it){var ref$;return this$.raw=(ref$=it||{}).raw,this$.binding=ref$.binding,this$}).then(function(){var ref$,_resizeLock;if(!this$.raw){this$.raw=[]}if(this$.layoutOpt){if(!(typeof layout!="undefined"&&layout!==null)){console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found.")}else{if(!layoutRoot){console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout.");console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false")}this$.layout=new layout(typeof this$.layoutOpt==="object"?(ref$=import$({},this$.layoutOpt),ref$.watchResize=false,ref$):{root:layoutRoot,watchResize:false})}}_resizeLock=proxise(function(){resizeObserver.add(this$.root,this$);return null});if(this$.forceInit&&!this$.root.offsetParent||window.getComputedStyle(this$.root).display==="none"){return}this$._resize=function(){return _resizeLock.resolve()};return _resizeLock()}).then(function(){return this$._resize=function(){}}).then(function(){var init,layoutLock;init=function(){if(this$.mod.init){return this$.mod.init.apply(this$)}};if(!this$.layout){return init()}layoutLock=proxise(function(){Promise.resolve(this$.layout.init(init));return null});this$._layout=function(){return layoutLock.resolve()};this$.layout.on("render",function(){return this$._layout()});return layoutLock()}).then(function(){this$._layout=function(){};Promise.resolve().then(function(){if(!this$.delayRender){return}this$.renderLock=proxise(function(){});return this$.renderLock()}).then(function(){this$._resize=function(){this$.resize();return this$.render()};this$._layout=function(){this$.parse();this$.bind();this$.resize();return this$.render()};this$.parse();this$.bind();this$.resize();return this$.render()})})},parse:function(){var this$=this;this.data=this.raw.map(function(r,i){var ret,k,v;ret={};(function(){var ref$,results$=[];for(k in ref$=this.binding){v=ref$[k];results$.push({k:k,v:v})}return results$}).call(this$).map(function(arg$){var k,v,ref$,ref1$,t;k=arg$.k,v=arg$.v;if(!v){return}ret[k]=((ref$=(ref1$=this$.mod).dimension||(ref1$.dimension={}))[k]||(ref$[k]={})).multiple?v.map(function(it){return r[it.key]}):r[v.key];t=((ref$=(ref1$=this$.mod).dimension||(ref1$.dimension={}))[k]||(ref$[k]={})).type;if(/[RIT]/.exec(t)&&!/[CN]/.exec(t)){return ret[k]=Array.isArray(ret[k])?ret[k].map(function(it){return parseFloat(it)}):parseFloat(ret[k])}});ret._raw=r;ret._idx=i;return ret});if(this.mod.parse){return this.mod.parse.apply(this)}},bind:function(){if(this.mod.bind){return this.mod.bind.apply(this)}},start:function(){this._aniloop.run();if(this.mod.start){return this.mod.start.apply(this)}},stop:function(){this._aniloop.pause();if(this.mod.stop){return this.mod.stop.apply(this)}},resize:function(){if(this.layout){this.layout.update(false)}this.box=this.root.getBoundingClientRect();if(this.mod.resize){return this.mod.resize.apply(this)}},tick:function(){if(this.mod.tick){return this.mod.tick.apply(this)}},render:function(){if(this.mod.render){return this.mod.render.apply(this)}},destroy:function(){var this$=this;return Promise.resolve().then(function(){if(this$._select){this$.root.removeEventListener("click",this$._select)}if(this$._hover){this$.root.removeEventListener("mouseover",this$._hover)}resizeObserver["delete"](this$.root);if(this$.layout){this$.layout.destroy()}this$.stop();if(this$.mod.destroy){return this$.mod.destroy.apply(this$)}})},config:function(opt){if(!(opt!=null&&opt)){return this.cfg}return import$(this.cfg,opt)},setBind:function(n,b){this.binding[n]=b;this.parse();this.bind();this.resize();return this.render()},setRaw:function(raw,binding,reinit){var ref$;reinit==null&&(reinit=false);if(!Array.isArray(raw)){ref$=raw,raw=ref$.raw,binding=ref$.binding,reinit=ref$.reinit}if(raw!=null){this.raw=raw}if(binding!=null){this.binding=binding}if(this.renderLock){this.renderLock.resolve();return this.renderLock=null}else{if(reinit&&this.mod.init){this.mod.init.apply(this)}this.parse();this.bind();this.resize();return this.render()}},on:function(n,cb){var this$=this;return(Array.isArray(n)?n:[n]).map(function(n){var ref$;return((ref$=this$.evtHandler)[n]||(ref$[n]=[])).push(cb)})},fire:function(n){var v,res$,i$,to$,ref$,len$,cb,results$=[];res$=[];for(i$=1,to$=arguments.length;i$<to$;++i$){res$.push(arguments[i$])}v=res$;for(i$=0,len$=(ref$=this.evtHandler[n]||[]).length;i$<len$;++i$){cb=ref$[i$];results$.push(cb.apply(this,v))}return results$},filter:function(filters,internal){var bs,k,ref$,v,u;filters==null&&(filters={});internal==null&&(internal=false);bs=[];for(k in ref$=this.binding){v=ref$[k];u=Array.isArray(v)?v:[v];u=u.map(fn$);bs=bs.concat(u)}for(k in filters){v=filters[k];bs.filter(fn1$).map(fn2$)}if(internal){this.fire("filter",filters)}if(this.mod.filter){this.mod.filter.apply(this,[filters,internal])}this.parse();this.bind();this.resize();return this.render();function fn$(v){return{k:k,v:v}}function fn1$(it){return it.k===k}function fn2$(it){return it.v.filter=v}}});if(typeof module!="undefined"&&module!==null){module.exports=chart}else if(typeof window!="undefined"&&window!==null){window.chart=chart}function import$(obj,src){var own={}.hasOwnProperty;for(var key in src)if(own.call(src,key))obj[key]=src[key];return obj}}).call(this);
|