@plotdb/chart 0.0.2 → 1.0.3

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 (164) hide show
  1. package/README.md +3 -3
  2. package/dist/chart.js +18 -12
  3. package/dist/chart.min.js +1 -1
  4. package/dist/index.css +8 -0
  5. package/dist/index.js +609 -0
  6. package/dist/index.min.css +1 -0
  7. package/dist/index.min.js +1 -0
  8. package/dist/utils/axis.js +6 -0
  9. package/dist/utils/axis.min.js +1 -1
  10. package/package.json +22 -11
  11. package/CHANGELOG.md +0 -11
  12. package/build +0 -39
  13. package/doc/charts.md +0 -58
  14. package/doc/config.md +0 -44
  15. package/doc/draft/chart.md +0 -146
  16. package/doc/draft/data.md +0 -8
  17. package/doc/draft/definition.md +0 -0
  18. package/doc/draft/events.md +0 -0
  19. package/doc/draft/filter.md +0 -0
  20. package/doc/draft/lifecycle.md +0 -89
  21. package/doc/spec.md +0 -89
  22. package/doc/todo.md +0 -27
  23. package/doc/utils/tip.md +0 -84
  24. package/src/chart.ls +0 -320
  25. package/src/chart.styl +0 -6
  26. package/src/data/en-US/category +0 -20
  27. package/src/data/en-US/fruit +0 -39
  28. package/src/data/en-US/movie +0 -125
  29. package/src/data/en-US/name +0 -58
  30. package/src/data/index.ls +0 -34
  31. package/src/data/zh-TW/category +0 -20
  32. package/src/data/zh-TW/fruits +0 -38
  33. package/src/data/zh-TW/movie +0 -125
  34. package/src/data/zh-TW/names +0 -105
  35. package/src/utils/axis.ls +0 -229
  36. package/src/utils/config.ls +0 -11
  37. package/src/utils/data.ls +0 -104
  38. package/src/utils/format.ls +0 -30
  39. package/src/utils/legend.ls +0 -134
  40. package/src/utils/legend.styl +0 -37
  41. package/src/utils/tint.ls +0 -66
  42. package/src/utils/tip.ls +0 -97
  43. package/web/src/pug/base.pug +0 -19
  44. package/web/src/pug/block/axis/0.0.1/index.ls +0 -38
  45. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  46. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -141
  47. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  48. package/web/src/pug/block/bar/0.0.1/index.ls +0 -274
  49. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  50. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -85
  51. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  52. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -83
  53. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  54. package/web/src/pug/block/base/0.0.1/index.ls +0 -67
  55. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  56. package/web/src/pug/block/blank/0.0.1/index.ls +0 -25
  57. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  58. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -220
  59. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -28
  60. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -89
  61. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  62. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  63. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -90
  64. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  65. package/web/src/pug/block/empty/0.0.1/index.ls +0 -27
  66. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  67. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -100
  68. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  69. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  70. package/web/src/pug/block/line/0.0.1/index.ls +0 -265
  71. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  72. package/web/src/pug/block/number/0.0.1/index.ls +0 -69
  73. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  74. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -167
  75. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  76. package/web/src/pug/block/pie/0.0.1/index.ls +0 -125
  77. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  78. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  79. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -185
  80. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  81. package/web/src/pug/block/radar/0.0.1/index.ls +0 -113
  82. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  83. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  84. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -128
  85. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  86. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -38
  87. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  88. package/web/src/pug/block/table/0.0.1/index.ls +0 -40
  89. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  90. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -48
  91. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  92. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -53
  93. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  94. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -172
  95. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  96. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -174
  97. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  98. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  99. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -61
  100. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  101. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -83
  102. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  103. package/web/src/pug/index.ls +0 -72
  104. package/web/src/pug/index.pug +0 -52
  105. package/web/src/styl/index.styl +0 -0
  106. package/web/static/assets/block/cache.js +0 -4
  107. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  108. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  109. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  110. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  111. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  112. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  113. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  114. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  115. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  116. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  117. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  118. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  119. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  120. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  121. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  122. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  123. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  124. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  125. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  126. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  127. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  128. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  129. package/web/static/assets/data/countrycode.json +0 -1
  130. package/web/static/assets/data/world-110m.json +0 -1
  131. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  132. package/web/static/assets/img/fluid.svg +0 -16
  133. package/web/static/block/axis/0.0.1/index.html +0 -79
  134. package/web/static/block/axis-bubble/0.0.1/index.html +0 -222
  135. package/web/static/block/bar/0.0.1/index.html +0 -581
  136. package/web/static/block/bar-list/0.0.1/index.html +0 -231
  137. package/web/static/block/bar-race/0.0.1/index.html +0 -184
  138. package/web/static/block/base/0.0.1/index.html +0 -197
  139. package/web/static/block/blank/0.0.1/index.html +0 -42
  140. package/web/static/block/bubble/0.0.1/index.html +0 -402
  141. package/web/static/block/bubble/0.0.1/test.html +0 -0
  142. package/web/static/block/curve-bar/0.0.1/index.html +0 -148
  143. package/web/static/block/dumbbell/0.0.1/index.html +0 -178
  144. package/web/static/block/empty/0.0.1/index.html +0 -76
  145. package/web/static/block/gauge/0.0.1/index.html +0 -150
  146. package/web/static/block/line/0.0.1/index.html +0 -540
  147. package/web/static/block/number/0.0.1/index.html +0 -152
  148. package/web/static/block/percent-list/0.0.1/index.html +0 -316
  149. package/web/static/block/pie/0.0.1/index.html +0 -281
  150. package/web/static/block/pie-bubble/0.0.1/index.html +0 -358
  151. package/web/static/block/radar/0.0.1/index.html +0 -149
  152. package/web/static/block/scatter/0.0.1/index.html +0 -251
  153. package/web/static/block/sheet/0.0.1/index.html +0 -103
  154. package/web/static/block/table/0.0.1/index.html +0 -73
  155. package/web/static/block/taiwantown/0.0.1/index.html +0 -210
  156. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -220
  157. package/web/static/block/treemap/0.0.1/index.html +0 -360
  158. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -350
  159. package/web/static/block/wordcloud/0.0.1/index.html +0 -92
  160. package/web/static/block/worldmap/0.0.1/index.html +0 -207
  161. package/web/static/css/index.css +0 -0
  162. package/web/static/css/index.min.css +0 -0
  163. package/web/static/favicon.ico +0 -0
  164. package/web/static/index.html +0 -153
package/dist/index.js ADDED
@@ -0,0 +1,609 @@
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
421
+ ? v
422
+ : [v]).map(function(it){
423
+ return r[it.key];
424
+ })
425
+ : r[v.key];
426
+ t = ((ref$ = (ref1$ = this$.mod).dimension || (ref1$.dimension = {}))[k] || (ref$[k] = {})).type;
427
+ if (/[RIT]/.exec(t) && !/[CN]/.exec(t)) {
428
+ return ret[k] = Array.isArray(ret[k])
429
+ ? ret[k].map(function(it){
430
+ return parseFloat(it);
431
+ })
432
+ : parseFloat(ret[k]);
433
+ }
434
+ });
435
+ ret._raw = r;
436
+ ret._idx = i;
437
+ return ret;
438
+ });
439
+ if (this.mod.parse) {
440
+ return this.mod.parse.apply(this);
441
+ }
442
+ },
443
+ bind: function(){
444
+ if (this.mod.bind) {
445
+ return this.mod.bind.apply(this);
446
+ }
447
+ },
448
+ start: function(){
449
+ this._aniloop.run();
450
+ if (this.mod.start) {
451
+ return this.mod.start.apply(this);
452
+ }
453
+ },
454
+ stop: function(){
455
+ this._aniloop.pause();
456
+ if (this.mod.stop) {
457
+ return this.mod.stop.apply(this);
458
+ }
459
+ },
460
+ resize: function(){
461
+ if (this.layout) {
462
+ this.layout.update(false);
463
+ }
464
+ this.box = this.root.getBoundingClientRect();
465
+ if (this.mod.resize) {
466
+ return this.mod.resize.apply(this);
467
+ }
468
+ },
469
+ tick: function(){
470
+ if (this.mod.tick) {
471
+ return this.mod.tick.apply(this);
472
+ }
473
+ },
474
+ render: function(){
475
+ if (this.mod.render) {
476
+ return this.mod.render.apply(this);
477
+ }
478
+ },
479
+ destroy: function(){
480
+ var this$ = this;
481
+ return Promise.resolve().then(function(){
482
+ if (this$._select) {
483
+ this$.root.removeEventListener('click', this$._select);
484
+ }
485
+ if (this$._hover) {
486
+ this$.root.removeEventListener('mouseover', this$._hover);
487
+ }
488
+ resizeObserver['delete'](this$.root);
489
+ if (this$.layout) {
490
+ this$.layout.destroy();
491
+ }
492
+ this$.stop();
493
+ if (this$.mod.destroy) {
494
+ return this$.mod.destroy.apply(this$);
495
+ }
496
+ });
497
+ },
498
+ config: function(opt){
499
+ if (!(opt != null && opt)) {
500
+ return this.cfg;
501
+ }
502
+ return import$(this.cfg, opt);
503
+ },
504
+ setBind: function(n, b){
505
+ this.binding[n] = b;
506
+ this.parse();
507
+ this.bind();
508
+ this.resize();
509
+ return this.render();
510
+ },
511
+ setRaw: function(raw, binding, reinit){
512
+ var ref$;
513
+ reinit == null && (reinit = false);
514
+ if (!Array.isArray(raw)) {
515
+ ref$ = raw, raw = ref$.raw, binding = ref$.binding, reinit = ref$.reinit;
516
+ }
517
+ if (raw != null) {
518
+ this.raw = raw;
519
+ }
520
+ if (binding != null) {
521
+ this.binding = binding;
522
+ }
523
+ if (this.renderLock) {
524
+ this.renderLock.resolve();
525
+ return this.renderLock = null;
526
+ } else {
527
+ if (reinit && this.mod.init) {
528
+ this.mod.init.apply(this);
529
+ }
530
+ this.parse();
531
+ this.bind();
532
+ this.resize();
533
+ return this.render();
534
+ }
535
+ },
536
+ on: function(n, cb){
537
+ var this$ = this;
538
+ return (Array.isArray(n)
539
+ ? n
540
+ : [n]).map(function(n){
541
+ var ref$;
542
+ return ((ref$ = this$.evtHandler)[n] || (ref$[n] = [])).push(cb);
543
+ });
544
+ },
545
+ fire: function(n){
546
+ var v, res$, i$, to$, ref$, len$, cb, results$ = [];
547
+ res$ = [];
548
+ for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
549
+ res$.push(arguments[i$]);
550
+ }
551
+ v = res$;
552
+ for (i$ = 0, len$ = (ref$ = this.evtHandler[n] || []).length; i$ < len$; ++i$) {
553
+ cb = ref$[i$];
554
+ results$.push(cb.apply(this, v));
555
+ }
556
+ return results$;
557
+ },
558
+ filter: function(filters, internal){
559
+ var bs, k, ref$, v, u;
560
+ filters == null && (filters = {});
561
+ internal == null && (internal = false);
562
+ bs = [];
563
+ for (k in ref$ = this.binding) {
564
+ v = ref$[k];
565
+ u = Array.isArray(v)
566
+ ? v
567
+ : [v];
568
+ u = u.map(fn$);
569
+ bs = bs.concat(u);
570
+ }
571
+ for (k in filters) {
572
+ v = filters[k];
573
+ bs.filter(fn1$).map(fn2$);
574
+ }
575
+ if (internal) {
576
+ this.fire('filter', filters);
577
+ }
578
+ if (this.mod.filter) {
579
+ this.mod.filter.apply(this, [filters, internal]);
580
+ }
581
+ this.parse();
582
+ this.bind();
583
+ this.resize();
584
+ return this.render();
585
+ function fn$(v){
586
+ return {
587
+ k: k,
588
+ v: v
589
+ };
590
+ }
591
+ function fn1$(it){
592
+ return it.k === k;
593
+ }
594
+ function fn2$(it){
595
+ return it.v.filter = v;
596
+ }
597
+ }
598
+ });
599
+ if (typeof module != 'undefined' && module !== null) {
600
+ module.exports = chart;
601
+ } else if (typeof window != 'undefined' && window !== null) {
602
+ window.chart = chart;
603
+ }
604
+ function import$(obj, src){
605
+ var own = {}.hasOwnProperty;
606
+ for (var key in src) if (own.call(src, key)) obj[key] = src[key];
607
+ return obj;
608
+ }
609
+ }).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?v:[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);
@@ -163,6 +163,9 @@
163
163
  ref$.paddingRight = "0";
164
164
  }
165
165
  n.domain.style.display = 'none';
166
+ ticks.map(function(o){
167
+ return o.n.g.style.display = 'none';
168
+ });
166
169
  return;
167
170
  } else {
168
171
  if (isHorizon) {
@@ -177,6 +180,9 @@
177
180
  ref$.paddingRight = "";
178
181
  }
179
182
  n.domain.style.display = '';
183
+ ticks.map(function(o){
184
+ return o.n.g.style.display = '';
185
+ });
180
186
  }
181
187
  fontSize = getComputedStyle(wrap).fontSize;
182
188
  box = n.layout.getBoundingClientRect();
@@ -1 +1 @@
1
- (function(){var ceNS,axis;ceNS=function(it){return document.createElementNS("http://www.w3.org/2000/svg",it)};axis=function(opt){var n,x$,y$,this$=this;opt==null&&(opt={});this.dir={bottom:0,left:2}[opt.direction||"bottom"];this.name=opt.name||"axis";this.layout=opt.layout||new layout({root:this.root});this._ticks=[];this._scale=opt.scale||function(it){return it};this._format=opt.format||(typeof chart!="undefined"&&chart!==null?chart.utils.format.simple:function(it){return it});this.cfg=import$({tickSize:8},opt.cfg);this._map={};this._n=n={root:ceNS("g"),layout:this.layout.getNode(this.name),render:this.layout.getGroup(this.name),wrap:null,domain:ceNS("path")};n.render.appendChild(n.root);n.root.appendChild(n.domain);n.label=ceNS("text");n.label.textContent="";x$=n.label;x$.setAttribute("dominant-baseline","hanging");x$.setAttribute("text-anchor","middle");n.root.appendChild(n.label);this.wrapper();y$=this.layout;y$.on("update",function(){return this$.update()});y$.on("render",function(){return this$.render()});return this};axis.prototype=import$(Object.create(Object.prototype),{wrapper:function(){var n,ref$;n=this._n;if(n.wrap&&n.wrap.parentNode){n.wrap.parentNode.removeChild(n.wrap)}n.wrap=document.createElement("div");import$((ref$=n.wrap.style,ref$.visibility="hidden",ref$.position="absolute",ref$.top=0,ref$.left=0,ref$.pointerEvents="none",ref$.userSelect="none",ref$.zIndex=0,ref$.wordBreak="break-all",ref$.lineHeight=".95em",ref$),this.dir<2&&this.cfg.textWidth!=null?{whiteSpace:"wrap",width:((ref$=this.cfg.textWidth)>1?ref$:1)+"em"}:{whiteSpace:"pre",width:"4em"});return n.layout.appendChild(n.wrap)},config:function(it){if(!(it!=null)){return this.cfg}import$(this.cfg,it);if(this.cfg.format){this.format(this.cfg.format)}return this.wrapper()},format:function(it){if(it!=null){return this._format=it}else{return this._format}},scale:function(it){if(it!=null){return this._scale=it}else{return this._scale}},caption:function(it){if(this.cfg.showCaption!=null&&!this.cfg.showCaption){return this._n.label.textContent=""}else{return this._n.label.textContent=it}},update:function(){},ticks:function(ticks){var map,size,count,itr,ref$,k,v,this$=this;map={};size=this._n.layout.getBoundingClientRect()[this.dir<2?"width":"height"];count=Math.round(size/25);itr=(ref$=Math.round(ticks.length/(count>1?count:1)))>1?ref$:1;this._ticks=ticks.filter(function(d,i){return!(i%itr)||i===ticks.length-1}).map(function(o){var ref$,key$;if(typeof o!=="object"){o={v:o}}return map[o.v]=import$((ref$=this$._map)[key$=o.v]||(ref$[key$]={}),o)});for(k in ref$=this._map){v=ref$[k];if(!map[k]){v.n.g.parentNode.removeChild(v.n.g)}}this._map=map;return this._ticks.filter(function(o){return!o.n}).map(function(o){o.n={g:ceNS("g"),p:ceNS("path"),t:ceNS("g")};o.n.g.appendChild(o.n.p);o.n.g.appendChild(o.n.t);this$._n.root.appendChild(o.n.g);if(isNaN(+o.v)){return o.t=o.v}})},render:function(){var n,isHorizon,wrap,ticks,ref$,fontSize,box,this$=this;n=this._n;isHorizon=this.dir<2;wrap=n.wrap;ticks=this._ticks;if(this.cfg.enabled!=null&&!this.cfg.enabled){if(isHorizon){ref$=n.layout.style;ref$.height="0px";ref$.paddingTop="0";ref$.paddingBottom="0"}else{ref$=n.layout.style;ref$.width="0px";ref$.paddingLeft="0";ref$.paddingRight="0"}n.domain.style.display="none";return}else{if(isHorizon){ref$=n.layout.style;ref$.height="";ref$.paddingTop="";ref$.paddingBottom=""}else{ref$=n.layout.style;ref$.width="";ref$.paddingLeft="";ref$.paddingRight=""}n.domain.style.display=""}fontSize=getComputedStyle(wrap).fontSize;box=n.layout.getBoundingClientRect();ref$=n.domain.style;ref$.strokeWidth=1;ref$.stroke="currentColor";ref$.fill="none";ticks.map(function(o,idx){var pos,ref$;pos=!idx?0:idx===ticks.length-1?2:1;o._c=o.c!=null?o.c:this$._scale(o.v)+(this$._scale.bandwidth?this$._scale.bandwidth()/2:0);o._t=o.t!=null?o.t:this$._format(o.v);ref$=o.n.p.style;ref$.strokeWidth=1;ref$.stroke="currentColor";ref$.fill="none";wrap.textContent=o._t;wrap.style.textAlign=isHorizon?["left","center","right"][pos]:["right","left"][this$.dir-2];o.n.tt=wrapSvgText({node:wrap});o.n.t.style.fontSize=fontSize;o.n.t.textContent="";return o.n.t.appendChild(o.n.tt)});ticks.sort(function(a,b){return a._c-b._c});if(isHorizon){n.domain.setAttribute("d","M0 0L"+box.width+" 0Z");n.label.setAttribute("x",box.width/2)}else{n.domain.setAttribute("d","M0 0L0 "+box.height+"Z");n.label.setAttribute("transform","translate(0,"+box.height/2+") rotate(90)")}ticks.map(function(o){return o.box=o.n.t.getBBox()});return this.adjust()},adjust:function(){var ticks,isHorizon,insert,bfs,this$=this;ticks=this._ticks;isHorizon=this.dir<2;insert=function(idx,lv,lc){var tick,pos,ref$,coord,text,box,offset,doOffset,r,m,ip1,ip2,op1,op2,overlap;if(lc.checked[idx]){return}else{lc.checked[idx]=true}tick=ticks[idx];pos=!idx?0:idx===ticks.length-1?2:1;ref$=[tick._c,tick._t],coord=ref$[0],text=ref$[1];box=tick.box;offset={x:-box.x,y:-box.y};doOffset=this$._scale.bandwidth?false:this$.cfg.boundaryTickOffset!=null?!!this$.cfg.boundaryTickOffset:this$.dir<2?true:false;r=doOffset?pos/2:1/2;if(isHorizon){offset.x-=box.width*r}else{offset.y-=box.height*r}tick.n.tt.setAttribute("transform","translate("+offset.x+","+offset.y+")");box={size:box[isHorizon?"width":"height"],sizeAlt:box[isHorizon?"height":"width"],lv:lv,tick:tick,idx:idx};box.coord=coord-box.size*r;if(isHorizon){tick.n.g.setAttribute("transform","translate("+coord+",0)");tick.n.p.setAttribute("d","M0 0L0 "+this$.cfg.tickSize);tick.n.t.setAttribute("transform","translate(0,"+this$.cfg.tickSize+")")}else{tick.n.g.setAttribute("transform","translate(0,"+coord+")");tick.n.p.setAttribute("d","M0 0L-"+this$.cfg.tickSize+" 0");tick.n.t.setAttribute("transform","translate("+(-this$.cfg.tickSize-box.sizeAlt-1)+",0)")}m=2;ref$=[box.coord,box.coord+box.size],ip1=ref$[0],ip2=ref$[1];ref$=[ip1-m,ip2+m],op1=ref$[0],op2=ref$[1];overlap=lc.picked.filter(function(b){var ref$,iq1,iq2,oq1,oq2;ref$=[b.coord,b.coord+b.size],iq1=ref$[0],iq2=ref$[1];ref$=[iq1-m,iq2+m],oq1=ref$[0],oq2=ref$[1];return ip1>oq1&&ip1<oq2||iq1>op1&&iq1<op2}).length;tick.n.t.style.opacity=overlap?0:1;lc.picked.push(box);return!overlap};bfs=function(maxlv){var ref$,lc,fifo,L,R,D,M,size,box;maxlv==null&&(maxlv=1);ref$=[{checked:{},picked:[],node:this$._n.wrap},[]],lc=ref$[0],fifo=ref$[1];lc.fontSize=getComputedStyle(lc.node).fontSize;ticks.map(function(it){return it.n.t.style.opacity=0});if(ticks.length){fifo.push([0,ticks.length-1,0]);[0,ticks.length-1].map(function(it){return insert(it,0,lc)})}while(fifo.length){ref$=fifo.splice(0,1)[0],L=ref$[0],R=ref$[1],D=ref$[2];if(D>=maxlv){continue}M=Math.floor((L+R)/2);insert(M,D,lc);if(M>L+1){fifo.push([L,M,D+1])}if(R>M+1){fifo.push([M,R,D+1])}}size=Math.max.apply(Math,[0].concat(lc.picked.map(function(it){return it.sizeAlt})));if(this$.dir<2){this$._n.label.setAttribute("y",size+this$.cfg.tickSize);return this$._n.layout.style.height=size+this$.cfg.tickSize+this$._n.label.getBoundingClientRect().height+"px"}else{this$._n.label.setAttribute("x",0);this$._n.label.setAttribute("y",0);this$._n.layout.style.width=size+this$.cfg.tickSize+this$._n.label.getBoundingClientRect().width+"px";box=this$._n.layout.getBoundingClientRect();this$._n.label.setAttribute("transform","translate("+-(size+this$.cfg.tickSize)+","+box.height/2+") rotate(90)");return this$._n.root.setAttribute("transform","translate("+box.width+",0)")}};return bfs(5)}});if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).axis=axis}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);
1
+ (function(){var ceNS,axis;ceNS=function(it){return document.createElementNS("http://www.w3.org/2000/svg",it)};axis=function(opt){var n,x$,y$,this$=this;opt==null&&(opt={});this.dir={bottom:0,left:2}[opt.direction||"bottom"];this.name=opt.name||"axis";this.layout=opt.layout||new layout({root:this.root});this._ticks=[];this._scale=opt.scale||function(it){return it};this._format=opt.format||(typeof chart!="undefined"&&chart!==null?chart.utils.format.simple:function(it){return it});this.cfg=import$({tickSize:8},opt.cfg);this._map={};this._n=n={root:ceNS("g"),layout:this.layout.getNode(this.name),render:this.layout.getGroup(this.name),wrap:null,domain:ceNS("path")};n.render.appendChild(n.root);n.root.appendChild(n.domain);n.label=ceNS("text");n.label.textContent="";x$=n.label;x$.setAttribute("dominant-baseline","hanging");x$.setAttribute("text-anchor","middle");n.root.appendChild(n.label);this.wrapper();y$=this.layout;y$.on("update",function(){return this$.update()});y$.on("render",function(){return this$.render()});return this};axis.prototype=import$(Object.create(Object.prototype),{wrapper:function(){var n,ref$;n=this._n;if(n.wrap&&n.wrap.parentNode){n.wrap.parentNode.removeChild(n.wrap)}n.wrap=document.createElement("div");import$((ref$=n.wrap.style,ref$.visibility="hidden",ref$.position="absolute",ref$.top=0,ref$.left=0,ref$.pointerEvents="none",ref$.userSelect="none",ref$.zIndex=0,ref$.wordBreak="break-all",ref$.lineHeight=".95em",ref$),this.dir<2&&this.cfg.textWidth!=null?{whiteSpace:"wrap",width:((ref$=this.cfg.textWidth)>1?ref$:1)+"em"}:{whiteSpace:"pre",width:"4em"});return n.layout.appendChild(n.wrap)},config:function(it){if(!(it!=null)){return this.cfg}import$(this.cfg,it);if(this.cfg.format){this.format(this.cfg.format)}return this.wrapper()},format:function(it){if(it!=null){return this._format=it}else{return this._format}},scale:function(it){if(it!=null){return this._scale=it}else{return this._scale}},caption:function(it){if(this.cfg.showCaption!=null&&!this.cfg.showCaption){return this._n.label.textContent=""}else{return this._n.label.textContent=it}},update:function(){},ticks:function(ticks){var map,size,count,itr,ref$,k,v,this$=this;map={};size=this._n.layout.getBoundingClientRect()[this.dir<2?"width":"height"];count=Math.round(size/25);itr=(ref$=Math.round(ticks.length/(count>1?count:1)))>1?ref$:1;this._ticks=ticks.filter(function(d,i){return!(i%itr)||i===ticks.length-1}).map(function(o){var ref$,key$;if(typeof o!=="object"){o={v:o}}return map[o.v]=import$((ref$=this$._map)[key$=o.v]||(ref$[key$]={}),o)});for(k in ref$=this._map){v=ref$[k];if(!map[k]){v.n.g.parentNode.removeChild(v.n.g)}}this._map=map;return this._ticks.filter(function(o){return!o.n}).map(function(o){o.n={g:ceNS("g"),p:ceNS("path"),t:ceNS("g")};o.n.g.appendChild(o.n.p);o.n.g.appendChild(o.n.t);this$._n.root.appendChild(o.n.g);if(isNaN(+o.v)){return o.t=o.v}})},render:function(){var n,isHorizon,wrap,ticks,ref$,fontSize,box,this$=this;n=this._n;isHorizon=this.dir<2;wrap=n.wrap;ticks=this._ticks;if(this.cfg.enabled!=null&&!this.cfg.enabled){if(isHorizon){ref$=n.layout.style;ref$.height="0px";ref$.paddingTop="0";ref$.paddingBottom="0"}else{ref$=n.layout.style;ref$.width="0px";ref$.paddingLeft="0";ref$.paddingRight="0"}n.domain.style.display="none";ticks.map(function(o){return o.n.g.style.display="none"});return}else{if(isHorizon){ref$=n.layout.style;ref$.height="";ref$.paddingTop="";ref$.paddingBottom=""}else{ref$=n.layout.style;ref$.width="";ref$.paddingLeft="";ref$.paddingRight=""}n.domain.style.display="";ticks.map(function(o){return o.n.g.style.display=""})}fontSize=getComputedStyle(wrap).fontSize;box=n.layout.getBoundingClientRect();ref$=n.domain.style;ref$.strokeWidth=1;ref$.stroke="currentColor";ref$.fill="none";ticks.map(function(o,idx){var pos,ref$;pos=!idx?0:idx===ticks.length-1?2:1;o._c=o.c!=null?o.c:this$._scale(o.v)+(this$._scale.bandwidth?this$._scale.bandwidth()/2:0);o._t=o.t!=null?o.t:this$._format(o.v);ref$=o.n.p.style;ref$.strokeWidth=1;ref$.stroke="currentColor";ref$.fill="none";wrap.textContent=o._t;wrap.style.textAlign=isHorizon?["left","center","right"][pos]:["right","left"][this$.dir-2];o.n.tt=wrapSvgText({node:wrap});o.n.t.style.fontSize=fontSize;o.n.t.textContent="";return o.n.t.appendChild(o.n.tt)});ticks.sort(function(a,b){return a._c-b._c});if(isHorizon){n.domain.setAttribute("d","M0 0L"+box.width+" 0Z");n.label.setAttribute("x",box.width/2)}else{n.domain.setAttribute("d","M0 0L0 "+box.height+"Z");n.label.setAttribute("transform","translate(0,"+box.height/2+") rotate(90)")}ticks.map(function(o){return o.box=o.n.t.getBBox()});return this.adjust()},adjust:function(){var ticks,isHorizon,insert,bfs,this$=this;ticks=this._ticks;isHorizon=this.dir<2;insert=function(idx,lv,lc){var tick,pos,ref$,coord,text,box,offset,doOffset,r,m,ip1,ip2,op1,op2,overlap;if(lc.checked[idx]){return}else{lc.checked[idx]=true}tick=ticks[idx];pos=!idx?0:idx===ticks.length-1?2:1;ref$=[tick._c,tick._t],coord=ref$[0],text=ref$[1];box=tick.box;offset={x:-box.x,y:-box.y};doOffset=this$._scale.bandwidth?false:this$.cfg.boundaryTickOffset!=null?!!this$.cfg.boundaryTickOffset:this$.dir<2?true:false;r=doOffset?pos/2:1/2;if(isHorizon){offset.x-=box.width*r}else{offset.y-=box.height*r}tick.n.tt.setAttribute("transform","translate("+offset.x+","+offset.y+")");box={size:box[isHorizon?"width":"height"],sizeAlt:box[isHorizon?"height":"width"],lv:lv,tick:tick,idx:idx};box.coord=coord-box.size*r;if(isHorizon){tick.n.g.setAttribute("transform","translate("+coord+",0)");tick.n.p.setAttribute("d","M0 0L0 "+this$.cfg.tickSize);tick.n.t.setAttribute("transform","translate(0,"+this$.cfg.tickSize+")")}else{tick.n.g.setAttribute("transform","translate(0,"+coord+")");tick.n.p.setAttribute("d","M0 0L-"+this$.cfg.tickSize+" 0");tick.n.t.setAttribute("transform","translate("+(-this$.cfg.tickSize-box.sizeAlt-1)+",0)")}m=2;ref$=[box.coord,box.coord+box.size],ip1=ref$[0],ip2=ref$[1];ref$=[ip1-m,ip2+m],op1=ref$[0],op2=ref$[1];overlap=lc.picked.filter(function(b){var ref$,iq1,iq2,oq1,oq2;ref$=[b.coord,b.coord+b.size],iq1=ref$[0],iq2=ref$[1];ref$=[iq1-m,iq2+m],oq1=ref$[0],oq2=ref$[1];return ip1>oq1&&ip1<oq2||iq1>op1&&iq1<op2}).length;tick.n.t.style.opacity=overlap?0:1;lc.picked.push(box);return!overlap};bfs=function(maxlv){var ref$,lc,fifo,L,R,D,M,size,box;maxlv==null&&(maxlv=1);ref$=[{checked:{},picked:[],node:this$._n.wrap},[]],lc=ref$[0],fifo=ref$[1];lc.fontSize=getComputedStyle(lc.node).fontSize;ticks.map(function(it){return it.n.t.style.opacity=0});if(ticks.length){fifo.push([0,ticks.length-1,0]);[0,ticks.length-1].map(function(it){return insert(it,0,lc)})}while(fifo.length){ref$=fifo.splice(0,1)[0],L=ref$[0],R=ref$[1],D=ref$[2];if(D>=maxlv){continue}M=Math.floor((L+R)/2);insert(M,D,lc);if(M>L+1){fifo.push([L,M,D+1])}if(R>M+1){fifo.push([M,R,D+1])}}size=Math.max.apply(Math,[0].concat(lc.picked.map(function(it){return it.sizeAlt})));if(this$.dir<2){this$._n.label.setAttribute("y",size+this$.cfg.tickSize);return this$._n.layout.style.height=size+this$.cfg.tickSize+this$._n.label.getBoundingClientRect().height+"px"}else{this$._n.label.setAttribute("x",0);this$._n.label.setAttribute("y",0);this$._n.layout.style.width=size+this$.cfg.tickSize+this$._n.label.getBoundingClientRect().width+"px";box=this$._n.layout.getBoundingClientRect();this$._n.label.setAttribute("transform","translate("+-(size+this$.cfg.tickSize)+","+box.height/2+") rotate(90)");return this$._n.root.setAttribute("transform","translate("+box.width+",0)")}};return bfs(5)}});if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).axis=axis}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);