@plotdb/chart 1.0.2 → 2.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 ADDED
@@ -0,0 +1,59 @@
1
+ # Change Logs
2
+
3
+ ## v2.0.1
4
+
5
+ - update documentation
6
+ - upgrade dependencies
7
+ - use `ctx()` to replace `setCtx()` in `utils/tip.ls`
8
+
9
+
10
+ ## v2.0.0
11
+
12
+ - further minimize generated js file with mangling and compression
13
+ - add `browser` field in `package.json`.
14
+ - add `style` in `package.json`
15
+ - upgrade modules
16
+ - patch test code to make it work with upgraded modules
17
+ - release with compact directory structure
18
+
19
+
20
+ ## v1.0.3
21
+
22
+ - fix bug: axis ticks still show even if axis is disabled
23
+ - enhancement: allow non-array binding even if corresponding dimension is defined with multiple as true.
24
+ - fix bug: tips in line streamgraph mode work incorrectly
25
+
26
+
27
+ ## v1.0.2
28
+
29
+ - release necessary files only
30
+ - add `main` field in `package.json`.
31
+
32
+
33
+ ## v1.0.1
34
+
35
+ - dont `postinstall npx fedep` since it may lead to installation failure.
36
+
37
+
38
+ ## v1.0.0
39
+
40
+ - adopt `@plotdb/block` v4 syntax
41
+
42
+
43
+ ## v0.0.3
44
+
45
+ - upgrade @plotdb/block and related modules. add @loadingio/vscroll
46
+ - support Promise-based sample function
47
+ - change context of `sample` so we can access `cfg` directly in `sample`
48
+ - add taiwancounty chart
49
+
50
+
51
+ ## v0.0.2
52
+
53
+ - use `palette` instead of `pal` in all charts, configurations and utils
54
+ - rename `Chart` to `chart`.
55
+ - rename `Aniloop` to `aniloop`
56
+ - export to `window` only if `module` is not defined.
57
+ - add config preset.
58
+ - update pie bubble chart
59
+ - tweak init and config flow. default config is now available.
package/README.md CHANGED
@@ -1,25 +1,26 @@
1
1
  # @plotdb/chart
2
2
 
3
- charting framework. In `@plotdb/chart`, charts are separated into 2 parts:
3
+ charting framework. In `@plotdb/chart`, charts are separated into 3 parts:
4
4
 
5
- - chart framework - define how a chart works, and provide an interface for controlling charts.
6
- - chart definition - specific chart definition and implementation.
5
+ - chart class - define how a chart works, and provide an interface for controlling charts.
6
+ - chart mod - specific chart definition and implementation.
7
+ - chart data - data, config, binding and other metadata.
7
8
 
8
- Chart framework provides:
9
+ Chart class provides:
9
10
 
10
11
  - chart lifecycle control - initing, resizing, rendering, destroying, etc
11
12
  - animation loop control.
12
13
  - rendering management for container resizing / visibility changing.
13
14
  - utility modules for common charting components.
14
15
 
15
- Chart Definition includes:
16
+ Chart mod includes:
16
17
 
17
18
  - the actual code for chart rendering
18
19
  - definition of user configurable options
19
20
  - accepted data formats
20
21
  - other metadata and dependencies
21
22
 
22
- While not in spec and not necessary, chart definitions can be encapsulated in `@plotdb/block` for modularization and abstraction.
23
+ While not in spec and not necessary, chart mod can be encapsulated in `@plotdb/block`.
23
24
 
24
25
 
25
26
  ## Usage
@@ -29,10 +30,10 @@ install via `@plotdb/chart`:
29
30
  npm install --save @plotdb/chart
30
31
 
31
32
 
32
- include `@plotdb/chart` js and css files under `dist`, mainly `chart.js` and `chart.css`:
33
+ include `@plotdb/chart` js and css files under `dist`, mainly `index.js` and `index.css`:
33
34
 
34
- <link rel="stylesheet" type="text/css" href="path-to-dist/chart.css"/>
35
- <script src="path-to-dist/chart.js"></script>
35
+ <link rel="stylesheet" type="text/css" href="path-to-dist/index.min.css"/>
36
+ <script src="path-to-dist/index.min.js"></script>
36
37
 
37
38
 
38
39
  then, create and initialize a chart object:
@@ -41,7 +42,7 @@ then, create and initialize a chart object:
41
42
  c.init().then(function() { ... });
42
43
 
43
44
 
44
- For more detail about chart module object, chart object constructor option and api interface, check `doc/spec.md`.
45
+ For more detail about chart module object, chart object constructor option and api interface, check `doc/index.md`.
45
46
 
46
47
 
47
48
 
File without changes
File without changes
@@ -417,7 +417,9 @@
417
417
  return;
418
418
  }
419
419
  ret[k] = ((ref$ = (ref1$ = this$.mod).dimension || (ref1$.dimension = {}))[k] || (ref$[k] = {})).multiple
420
- ? v.map(function(it){
420
+ ? (v.map
421
+ ? v
422
+ : [v]).map(function(it){
421
423
  return r[it.key];
422
424
  })
423
425
  : r[v.key];
@@ -592,6 +594,16 @@
592
594
  function fn2$(it){
593
595
  return it.v.filter = v;
594
596
  }
597
+ },
598
+ sample: function(){
599
+ if (this.mod.sample) {
600
+ return this.mod.sample.apply(this);
601
+ } else {
602
+ return {
603
+ raw: [],
604
+ binding: {}
605
+ };
606
+ }
595
607
  }
596
608
  });
597
609
  if (typeof module != 'undefined' && module !== null) {
File without changes
package/index.min.js ADDED
@@ -0,0 +1 @@
1
+ !function(){var n,i,o,s,u,a,t;function l(t,e){var n,r={}.hasOwnProperty;for(n in e)r.call(e,n)&&(t[n]=e[n]);return t}n=function(t,e,n){for(var r=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=r;t&&t!==n&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(i=function(){return this.running=!1,this.time={now:0,last:0},this.fps(60),this.evtHandler={},this}).prototype=l(Object.create(Object.prototype),{on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},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(t){return null!=t&&(this.running=!t),this.running?this.pause():this.run()},pause:function(){return this.running=!1},render:function(){return this.fire("tick",this.time.now)},run:function(t){var e=this;if(null!=t&&this.fps(t),!this.running)return this.running=!0,requestAnimationFrame(function(t){return e.handler(e.time.last=t,!0)})},throttle:function(t){return this.isThrottled=t=null==t?!0:t},fps:function(t){return null==t?this._fps_val:(this._fps_val=.01<t?t:.01,this._fps_delay=1e3/this._fps_val)},handler:function(t,e){var n,r=this;if(null==e&&(e=!1),this.running)return this.time.now=t,n=this.isThrottled?1e3<(n=this._fps_delay)?n:1e3:this._fps_delay,(e||this.time.now-this.time.last>=n)&&(this.time.last=t,this.render()),requestAnimationFrame(function(t){return r.handler(t,!1)})}}),o={list:[],init:function(){var t,n,r=this;return this.inited=!0,t=null==document.hidden&&null==document.msHidden&&null!=document.webkiHidden?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],n=t[0],document.addEventListener(t[1],debounce(150,function(){var e=!!document[n];return r.list.map(function(t){return t.throttle(e)})},!1))},add:function(t){return this.inited||this.init(),this.list.push(t)}},s={wm:new WeakMap,ro:new ResizeObserver(function(t){return t.map(function(t){return s.wm.get(t.target)._resize()})}),add:function(t,e){return this.wm.set(t,e),this.ro.observe(t)},delete:function(t){return this.ro.unobserve(t),this.wm.delete(t)}},u=function(t,e){return null==e&&(e={}),function(t,e){var n,r;for(n in e)r=e[n],null==t[n]?t[n]=r:"object"==typeof t[n]&&"object"==typeof r&&u(t[n],e[n]);return t}(t=null==t?{}:t,e=JSON.parse(JSON.stringify(e)))},a=function(t){var o=function(t,e){var n,r,i;for(r in null==e&&(e={}),n=t.child,t)(i=t[r]).type?i.default&&(e[r]=i.default):o(i,e[r]||(e[r]={}));return e};return o(t)},(t=function(t){var e=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.useSample=null==t.useSample||t.useSample,this.autoSelect=null==t.autoSelect||t.autoSelect,this.forceInit=t.forceInit||!1,this.prepareSvg=null==t.prepareSvg||t.prepareSvg,this.layoutOpt=null==t.layout||t.layout,this.delayRender=t.delayRender||!1,this.dataAccessor=null!=t.dataAccessor?t.dataAccessor:function(t){return t?t.data._raw:null},this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},this.evtHandler={},this.init=proxise.once(function(){return e._init()}),this._resize=null,this.autoSelect&&(this.root.addEventListener("click",this._select=function(t){if(t=n(t.target,".data",e.root))return e.fire("select",[{data:e.dataAccessor(t),node:t}])}),this.root.addEventListener("mouseover",this._hover=function(t){if(t=ld$.parent(t.target,".data",e.root))return e.fire("hover",[{data:e.dataAccessor(t),node:t}])})),this}).prototype=l(Object.create(Object.prototype),{_init:function(){var n,t,e,r=this;return"static"===window.getComputedStyle(this.root).position&&(this.root.style.position="relative"),n=this.layoutOpt?"object"!=typeof this.layoutOpt?this.root.querySelector(".pdl-layout"):"string"==typeof this.layoutOpt.root?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root||null:null,this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),(t=this.svg.style).width="100%",t.height="100%",this.layoutOpt&&(n||console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. "),(e=n.querySelector("[data-type=render]"))||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.")),(e||this.root).appendChild(this.svg)),this._aniloop=new i,o.add(this._aniloop),this._aniloop.on("tick",function(){return r.tick()}),Promise.resolve().then(function(){var t=a(r.mod.config||{});if(u(r.cfg,t),(!r.raw||!Array.isArray(r.raw))&&r.useSample&&r.mod.sample)return(t=r.mod.sample.apply(r)).then?t.then():Promise.resolve(t)}).then(function(t){return r.raw=(t=t||{}).raw,r.binding=t.binding,r}).then(function(){var t,e;if(r.raw||(r.raw=[]),r.layoutOpt&&("undefined"==typeof layout||null===layout?console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."):(n||(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")),r.layout=new layout("object"==typeof r.layoutOpt?((t=l({},r.layoutOpt)).watchResize=!1,t):{root:n,watchResize:!1}))),e=proxise(function(){return s.add(r.root,r),null}),(!r.forceInit||r.root.offsetParent)&&"none"!==window.getComputedStyle(r.root).display)return r._resize=function(){return e.resolve()},e()}).then(function(){return r._resize=function(){}}).then(function(){var t,e=function(){if(r.mod.init)return r.mod.init.apply(r)};return r.layout?(t=proxise(function(){return Promise.resolve(r.layout.init(e)),null}),r._layout=function(){return t.resolve()},r.layout.on("render",function(){return r._layout()}),t()):e()}).then(function(){r._layout=function(){},Promise.resolve().then(function(){if(r.delayRender)return r.renderLock=proxise(function(){}),r.renderLock()}).then(function(){return r._resize=function(){return r.resize(),r.render()},r._layout=function(){return r.parse(),r.bind(),r.resize(),r.render()},r.parse(),r.bind(),r.resize(),r.render()})})},parse:function(){var s=this;if(this.data=this.raw.map(function(i,t){var n,r,o={};return function(){var t,e=[];for(n in t=this.binding)r=t[n],e.push({k:n,v:r});return e}.call(s).map(function(t){var e,n=t.k,r=t.v;if(r)return o[n]=((t=(e=s.mod).dimension||(e.dimension={}))[n]||(t[n]={})).multiple?(r.map?r:[r]).map(function(t){return i[t.key]}):i[r.key],t=((t=(e=s.mod).dimension||(e.dimension={}))[n]||(t[n]={})).type,/[RIT]/.exec(t)&&!/[CN]/.exec(t)?o[n]=Array.isArray(o[n])?o[n].map(function(t){return parseFloat(t)}):parseFloat(o[n]):void 0}),o._raw=i,o._idx=t,o}),this.mod.parse)return this.mod.parse.apply(this)},bind:function(){if(this.mod.bind)return this.mod.bind.apply(this)},start:function(){if(this._aniloop.run(),this.mod.start)return this.mod.start.apply(this)},stop:function(){if(this._aniloop.pause(),this.mod.stop)return this.mod.stop.apply(this)},resize:function(){if(this.layout&&this.layout.update(!1),this.box=this.root.getBoundingClientRect(),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 t=this;return Promise.resolve().then(function(){if(t._select&&t.root.removeEventListener("click",t._select),t._hover&&t.root.removeEventListener("mouseover",t._hover),s.delete(t.root),t.layout&&t.layout.destroy(),t.stop(),t.mod.destroy)return t.mod.destroy.apply(t)})},config:function(t){return null!=t&&t?l(this.cfg,t):this.cfg},setBind:function(t,e){return this.binding[t]=e,this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var r;return null==n&&(n=!1),Array.isArray(t)||(t=(r=t).raw,e=r.binding,n=r.reinit),null!=t&&(this.raw=t),null!=e&&(this.binding=e),this.renderLock?(this.renderLock.resolve(),this.renderLock=null):(n&&this.mod.init&&this.mod.init.apply(this),this.parse(),this.bind(),this.resize(),this.render())},on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},filter:function(t,e){var n,r,i,o,s;for(r in null==t&&(t={}),null==e&&(e=!1),n=[],i=this.binding)o=i[r],s=(s=Array.isArray(o)?o:[o]).map(u),n=n.concat(s);for(r in t)o=t[r],n.filter(a).map(l);return e&&this.fire("filter",t),this.mod.filter&&this.mod.filter.apply(this,[t,e]),this.parse(),this.bind(),this.resize(),this.render();function u(t){return{k:r,v:t}}function a(t){return t.k===r}function l(t){return t.v.filter=o}},sample:function(){return this.mod.sample?this.mod.sample.apply(this):{raw:[],binding:{}}}}),"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.chart=t)}.call(this);
package/package.json CHANGED
@@ -1,94 +1 @@
1
- {
2
- "author": "zbryikt",
3
- "name": "@plotdb/chart",
4
- "license": "MIT",
5
- "description": "plotdb charts",
6
- "main": "dist/index.min.js",
7
- "files": ["dist/**/*"],
8
- "version": "1.0.2",
9
- "homepage": "https://github.com/plotdb/chart",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/plotdb/chart"
13
- },
14
- "engines": {
15
- "node": ">=10.14.1",
16
- "npm": ">=6.4.1"
17
- },
18
- "scripts": {
19
- "start": "npx server -r web -o true"
20
- },
21
- "devDependencies": {
22
- "@loadingio/bootstrap.ext": "^0.0.1",
23
- "@loadingio/ldquery": "^2.2.0",
24
- "@loadingio/loading.css": "^2.0.1",
25
- "@loadingio/vscroll": "^0.0.6",
26
- "@plotdb/layout": "^0.0.10",
27
- "@plotdb/pdmap-world": "^0.0.3",
28
- "@plotdb/sheet": "^0.1.7",
29
- "@zbryikt/template": "^2.3.22",
30
- "bootstrap": "^4.5.2",
31
- "bootstrap.native": "^3.0.15",
32
- "fedep": "^0.0.16",
33
- "ldiconfont": "^0.1.8",
34
- "ldloader": "^2.0.1",
35
- "ldview": "^0.2.3",
36
- "livescript": "^1.6.0",
37
- "pdmaptw": "0.0.4",
38
- "uglify-js": "^3.2.0",
39
- "uglifycss": "^0.0.29",
40
- "zmgr": "^1.0.0"
41
- },
42
- "frontendDependencies": {
43
- "root": "web/static/assets/lib",
44
- "modules": [
45
- "bootstrap",
46
- "bootstrap.native",
47
- "@loadingio/bootstrap.ext",
48
- "@loadingio/ldquery",
49
- "@loadingio/loading.css",
50
- "@loadingio/ldcolorpicker",
51
- "@loadingio/debounce.js",
52
- "@loadingio/vscroll",
53
- "@plotdb/pdmap-world",
54
- "@plotdb/block",
55
- "@plotdb/csscope",
56
- "@plotdb/rescope",
57
- "@plotdb/layout",
58
- "@plotdb/sheet",
59
- "@plotdb/konfig",
60
- "@zbryikt/voronoijs",
61
- "choosefont.js",
62
- "pdmaptw",
63
- "proxise",
64
- "ldiconfont",
65
- "ldloader",
66
- "ldcover",
67
- "ldcolor",
68
- "ldslider",
69
- "wrap-svg-text",
70
- "ldpalettepicker",
71
- "zmgr",
72
- "ldview"
73
- ]
74
- },
75
- "dependencies": {
76
- "@loadingio/debounce.js": "^0.0.1",
77
- "@loadingio/ldcolorpicker": "^2.0.4",
78
- "@plotdb/block": "^4.0.0",
79
- "@plotdb/csscope": "^3.0.3",
80
- "@plotdb/konfig": "^3.0.0",
81
- "@plotdb/rescope": "^4.0.5",
82
- "@zbryikt/voronoijs": "^0.0.1",
83
- "choosefont.js": "^0.0.1",
84
- "ldcolor": "^0.0.4",
85
- "ldcover": "^2.0.0",
86
- "ldpalettepicker": "^3.1.3",
87
- "ldslider": "^2.0.6",
88
- "proxise": "^0.1.6",
89
- "wrap-svg-text": "^0.0.6"
90
- },
91
- "peerDependencies": {
92
- "proxise": "^0.1.6"
93
- }
94
- }
1
+ {"author":"zbryikt","name":"@plotdb/chart","license":"MIT","description":"plotdb charts","style":"index.min.css","browser":"index.min.js","main":"index.min.js","version":"2.0.1","homepage":"https://github.com/plotdb/chart","repository":{"type":"git","url":"https://github.com/plotdb/chart"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.9","@loadingio/ldquery":"^3.0.4","@loadingio/loading.css":"^3.1.0","@loadingio/vscroll":"^0.0.8","@plotdb/layout":"^0.0.12","@plotdb/pdmap-world":"^0.0.5","@plotdb/semver":"^0.0.3","@plotdb/sheet":"^0.2.0","@zbryikt/template":"^2.3.38","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","fedep":"^1.1.7","ldiconfont":"^0.2.3","ldbutton":"^2.0.1","ldloader":"^3.0.1","ldview":"^1.2.1","livescript":"^1.6.0","pdmaptw":"2.0.1","uglify-js":"^3.13.1","uglifycss":"^0.0.29","zmgr":"^2.2.3"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/loading.css","@loadingio/ldcolorpicker","@loadingio/debounce.js","@loadingio/vscroll","@plotdb/pdmap-world","@plotdb/block","@plotdb/csscope","@plotdb/rescope","@plotdb/layout","@plotdb/sheet","@plotdb/konfig","@plotdb/semver","@zbryikt/voronoijs","d3","d3-array","d3-axis","d3-brush","d3-color","d3-dispatch","d3-drag","d3-ease","d3-force","d3-force-boundary","d3-format","d3-hierarchy","d3-interpolate","d3-path","d3-quadtree","d3-random","d3-scale-chromatic","d3-selection","d3-shape","d3-timer","d3-transition","choosefont.js","pdmaptw","proxise","ldiconfont","ldloader","ldbutton","ldcover","ldcolor","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@loadingio/ldcolorpicker":"^3.0.0","@plotdb/block":"^4.6.1","@plotdb/csscope":"^4.0.6","@plotdb/konfig":"^4.2.7","@plotdb/rescope":"^4.1.6","@zbryikt/voronoijs":"^1.0.0","d3":"^4.13.0","d3-array":"^3.1.1","d3-axis":"^3.0.0","d3-brush":"^3.0.0","d3-color":"^3.0.1","d3-dispatch":"^3.0.1","d3-drag":"^3.0.0","d3-ease":"^3.0.1","d3-force":"^3.0.0","d3-force-boundary":"^0.0.2","d3-format":"^3.1.0","d3-hierarchy":"^3.1.1","d3-interpolate":"^3.0.1","d3-path":"^3.0.1","d3-quadtree":"^3.0.1","d3-random":"^3.0.1","d3-scale-chromatic":"^3.0.0","d3-selection":"^3.0.0","d3-shape":"^3.1.0","d3-timer":"^3.0.1","d3-transition":"^3.0.1","choosefont.js":"^0.0.1","ldcolor":"^1.0.0","ldcover":"^3.2.1","ldpalettepicker":"^4.0.1","ldslider":"^3.0.4","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}
@@ -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();
@@ -0,0 +1 @@
1
+ !function(){var s,t;function h(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}s=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},(t=function(t){var e,n=this;return this.dir={bottom:0,left:2}[(t=null==t?{}:t).direction||"bottom"],this.name=t.name||"axis",this.layout=t.layout||new layout({root:this.root}),this._ticks=[],this._scale=t.scale||function(t){return t},this._format=t.format||("undefined"!=typeof chart&&null!==chart?chart.utils.format.simple:function(t){return t}),this.cfg=h({tickSize:8},t.cfg),this._map={},this._n=e={root:s("g"),layout:this.layout.getNode(this.name),render:this.layout.getGroup(this.name),wrap:null,domain:s("path")},e.render.appendChild(e.root),e.root.appendChild(e.domain),e.label=s("text"),e.label.textContent="",(t=e.label).setAttribute("dominant-baseline","hanging"),t.setAttribute("text-anchor","middle"),e.root.appendChild(e.label),this.wrapper(),(e=this.layout).on("update",function(){return n.update()}),e.on("render",function(){return n.render()}),this}).prototype=h(Object.create(Object.prototype),{wrapper:function(){var t,e=this._n;return e.wrap&&e.wrap.parentNode&&e.wrap.parentNode.removeChild(e.wrap),e.wrap=document.createElement("div"),h(((t=e.wrap.style).visibility="hidden",t.position="absolute",t.top=0,t.left=0,t.pointerEvents="none",t.userSelect="none",t.zIndex=0,t.wordBreak="break-all",t.lineHeight=".95em",t),this.dir<2&&null!=this.cfg.textWidth?{whiteSpace:"wrap",width:(1<(t=this.cfg.textWidth)?t:1)+"em"}:{whiteSpace:"pre",width:"4em"}),e.layout.appendChild(e.wrap)},config:function(t){return null==t?this.cfg:(h(this.cfg,t),this.cfg.format&&this.format(this.cfg.format),this.wrapper())},format:function(t){return null!=t?this._format=t:this._format},scale:function(t){return null!=t?this._scale=t:this._scale},caption:function(t){return null==this.cfg.showCaption||this.cfg.showCaption?this._n.label.textContent=t:this._n.label.textContent=""},update:function(){},ticks:function(n){var t,e,i,r=this,a={},o=this._n.layout.getBoundingClientRect()[this.dir<2?"width":"height"],o=Math.round(o/25),l=1<(t=Math.round(n.length/(1<o?o:1)))?t:1;for(e in this._ticks=n.filter(function(t,e){return!(e%l)||e===n.length-1}).map(function(t){var e,n;return a[(t="object"!=typeof t?{v:t}:t).v]=h((e=r._map)[n=t.v]||(e[n]={}),t)}),t=this._map)i=t[e],a[e]||i.n.g.parentNode.removeChild(i.n.g);return this._map=a,this._ticks.filter(function(t){return!t.n}).map(function(t){if(t.n={g:s("g"),p:s("path"),t:s("g")},t.n.g.appendChild(t.n.p),t.n.g.appendChild(t.n.t),r._n.root.appendChild(t.n.g),isNaN(+t.v))return t.t=t.v})},render:function(){var t,i,e,r=this,n=this._n,a=this.dir<2,o=n.wrap,l=this._ticks;return null==this.cfg.enabled||this.cfg.enabled?(a?((t=n.layout.style).height="",t.paddingTop="",t.paddingBottom=""):((t=n.layout.style).width="",t.paddingLeft="",t.paddingRight=""),n.domain.style.display="",l.map(function(t){return t.n.g.style.display=""}),i=getComputedStyle(o).fontSize,e=n.layout.getBoundingClientRect(),(t=n.domain.style).strokeWidth=1,t.stroke="currentColor",t.fill="none",l.map(function(t,e){var n=e?e===l.length-1?2:1:0;return t._c=null!=t.c?t.c:r._scale(t.v)+(r._scale.bandwidth?r._scale.bandwidth()/2:0),t._t=null!=t.t?t.t:r._format(t.v),(e=t.n.p.style).strokeWidth=1,e.stroke="currentColor",e.fill="none",o.textContent=t._t,o.style.textAlign=a?["left","center","right"][n]:["right","left"][r.dir-2],t.n.tt=wrapSvgText({node:o}),t.n.t.style.fontSize=i,t.n.t.textContent="",t.n.t.appendChild(t.n.tt)}),l.sort(function(t,e){return t._c-e._c}),a?(n.domain.setAttribute("d","M0 0L"+e.width+" 0Z"),n.label.setAttribute("x",e.width/2)):(n.domain.setAttribute("d","M0 0L0 "+e.height+"Z"),n.label.setAttribute("transform","translate(0,"+e.height/2+") rotate(90)")),l.map(function(t){return t.box=t.n.t.getBBox()}),this.adjust()):(a?((t=n.layout.style).height="0px",t.paddingTop="0",t.paddingBottom="0"):((t=n.layout.style).width="0px",t.paddingLeft="0",t.paddingRight="0"),n.domain.style.display="none",void l.map(function(t){return t.n.g.style.display="none"}))},adjust:function(){var c=this,d=this._ticks,p=this.dir<2,u=function(t,e,n){var i,r,a,o,l,s,h,u;if(!n.checked[t])return n.checked[t]=!0,i=d[t],o=t?t===d.length-1?2:1:0,u=[i._c,i._t][0],a={x:-(r=i.box).x,y:-r.y},o=!c._scale.bandwidth&&(null!=c.cfg.boundaryTickOffset?!!c.cfg.boundaryTickOffset:c.dir<2)?o/2:.5,p?a.x-=r.width*o:a.y-=r.height*o,i.n.tt.setAttribute("transform","translate("+a.x+","+a.y+")"),(r={size:r[p?"width":"height"],sizeAlt:r[p?"height":"width"],lv:e,tick:i,idx:t}).coord=u-r.size*o,p?(i.n.g.setAttribute("transform","translate("+u+",0)"),i.n.p.setAttribute("d","M0 0L0 "+c.cfg.tickSize),i.n.t.setAttribute("transform","translate(0,"+c.cfg.tickSize+")")):(i.n.g.setAttribute("transform","translate(0,"+u+")"),i.n.p.setAttribute("d","M0 0L-"+c.cfg.tickSize+" 0"),i.n.t.setAttribute("transform","translate("+(-c.cfg.tickSize-r.sizeAlt-1)+",0)")),u=[r.coord,r.coord+r.size],s=(u=[(l=u[0])-2,u[1]+2])[0],h=u[1],u=n.picked.filter(function(t){var e=[t.coord,t.coord+t.size],t=e[0];return(e=[t-2,e[1]+2])[0]<l&&l<e[1]||s<t&&t<h}).length,i.n.t.style.opacity=u?0:1,n.picked.push(r),!u};return function(t){var e,n,i,r,a,o,l,s,h;for(null==t&&(t=1),e=[{checked:{},picked:[],node:c._n.wrap},[]],n=e[0],i=e[1],n.fontSize=getComputedStyle(n.node).fontSize,d.map(function(t){return t.n.t.style.opacity=0}),d.length&&(i.push([0,d.length-1,0]),[0,d.length-1].map(function(t){return u(t,0,n)}));i.length;)r=(e=i.splice(0,1)[0])[0],a=e[1],t<=(o=e[2])||(l=Math.floor((r+a)/2),u(l,o,n),r+1<l&&i.push([r,l,o+1]),l+1<a&&i.push([l,a,o+1]));return s=Math.max.apply(Math,[0].concat(n.picked.map(function(t){return t.sizeAlt}))),c.dir<2?(c._n.label.setAttribute("y",s+c.cfg.tickSize),c._n.layout.style.height=s+c.cfg.tickSize+c._n.label.getBoundingClientRect().height+"px"):(c._n.label.setAttribute("x",0),c._n.label.setAttribute("y",0),c._n.layout.style.width=s+c.cfg.tickSize+c._n.label.getBoundingClientRect().width+"px",h=c._n.layout.getBoundingClientRect(),c._n.label.setAttribute("transform","translate("+-(s+c.cfg.tickSize)+","+h.height/2+") rotate(90)"),c._n.root.setAttribute("transform","translate("+h.width+",0)"))}(5)}}),"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).axis=t)}.call(this);
File without changes
@@ -0,0 +1 @@
1
+ !function(){var t={preset:{default:{margin:{type:"number"},font:{size:{type:"number",min:1,max:256,step:1,default:16}},color:{type:"color"},palette:{type:"palette"},background:{type:"color"}}}};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).config=t)}.call(this);
File without changes
@@ -0,0 +1 @@
1
+ !function(){var h={number:function(t){return(t=(t=null==t?{}:t).data.filter(function(t){return!(!t||""===(t+"").trim())})).filter(function(t){return!isNaN(parseFloat(t))}).length/t.length},serial:function(t){var n,r,e,u,i,a,o;for((n=[].concat((t=null==t?{}:t).data)).sort(function(t,n){return n-t}),r={},e=1,u=n.length;e<u;++e)i=e,isNaN(n[i])||isNaN(n[i-1])?r[n[i]>n[i-1]?n[i]+":"+n[i-1]:n[i-1]+":"+n[i]]=!0:a=n[i]-n[i-1],r[a]=!0;return 1/(function(){var t=[];for(o in r)t.push(o);return t}().filter(function(t){return"0"!==t}).length||2)},text:function(t){return 1-this.number(t=null==t?{}:t)},category:function(t){var n;return null==t&&(t={}),n=(n=0<(n=1-(0<(n=Array.from(new Set(t.data)).length-2)?n:0)/(n=t.data.length)-1/n)?n:0)<1?n:1,this.number(t)&&(n*=.9),n},parse:function(t){var n,r;return Array.isArray(t)?(n=t.slice(0,1)[0],r=(r=t.slice(1)).map(function(r,t){var e={};return n.map(function(t,n){return e[t]=r[n]}),e}),{head:n,body:r}):t},autotype:function(t){var n,r,e,u,i,a,o,l,f=[];for(r in(t=null==t?[]:t)[0]||{})f.push(r);for(e=[],u=0,i=(n=f).length;u<i;++u)a=n[u],l=t.map(s),o={key:a,types:{R:h.number({data:l}),O:h.serial({data:l}),N:h.text({data:l}),C:h.category({data:l})}},(l=["R","O","N","C"].map(p)).sort(c),o.type=l[0][0],e.push(o);return e;function s(t){return t[a]}function p(t){return[t,o.types[t]]}function c(t,n){return n[1]-t[1]}},autobind:function(t,r){var n,e,u,i,a,o,l,f,s,p,c,h,y,d,v;for(null==r&&(r={}),n=this.autotype(t=null==t?[]:t),(e=function(){var t,n=[];for(u in t=r)i=t[u],n.push({k:u,v:i});return n}().filter(function(t){return!t.v.passive})).sort(function(t,n){var r=(t.v.priority||100)-(n.v.priority||100);return 0!=r?r:(n=[t.v.type||"R",n.v.type||"R"].map(function(e){return Math.min.apply(Math,function(){for(var t=[],n=0,r=e.length;n<r;++n)t.push(n);return t}().map(function(t){return"CONR".indexOf(e[t])}))}))[0]-n[1]}),a=0,o=e.length;a<o;++a)for((l=e[a]).bind=null,s=0,p=(f=l.v.type||"RNOC").length;s<p;++s)for(c=f[s],n.sort(g),h=0,y=n.length;h<y;++h)if(!((d=n[h]).types[c]<.5||d.used||"C"===c&&.5<d.types.R)){l.bind=l.v.multiple?[d]:d,d.used=!0;break}for(a=0,o=e.length;a<o;++a)if((l=e[a]).v.multiple)for(s=0,p=(f=l.v.type||"RNOC").length;s<p;++s)for(c=f[s],n.sort(m),h=0,y=n.length;h<y;++h)(d=n[h]).types[c]<.5||d.used||"C"===c&&.5<d.types.R||(l.bind.push(d),d.used=!0);for(v={},a=0,o=e.length;a<o;++a)(l=e[a]).bind&&(v[l.k]=l.bind,(Array.isArray(l.bind)?l.bind:[l.bind]).map(b));return v;function g(t,n){var r=(n.types[c]||0)-(t.types[c]||0);return n.types[c]===t.types[c]&&"R"===c?(t.types.O||0)-(n.types.O||0):r}function m(t,n){var r=(n[c]||0)-(t[c]||0);return n[c]===t[c]&&"R"===c?(t.O||0)-(n.O||0):r}function b(t){var n=t.used;return delete t.used,n}}};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).data=h)}.call(this);
File without changes
@@ -0,0 +1 @@
1
+ !function(){var t={auto:function(t){return null==t&&(t=[]),d3.format(".3s")},simple:function(t){return isNaN(t=+t)?t:1e9<=t?(t/1e9).toFixed(0)+"G":1e6<=t?(t/1e6).toFixed(0)+"M":1e3<=t?(t/1e3).toFixed(0)+"K":Math.floor(t)===t?t.toFixed(0):t.toFixed(2)}};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).format=t)}.call(this);
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ !function(){var o,t;o="http://www.w3.org/2000/svg",(t=function(a){var t,e,n,r,l=this;return null==a&&(a={}),this._data=a.data||[],this.name=a.name||"legend",this.cfg=a.cfg||{},this.root="string"==typeof a.root?document.querySelector(a.root):a.root,this.dir=a.direction||"vertical",this.evtHandler={},this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})),this.layout=a.layout||new layout({root:this.root}),(n=this.layout).on("update",function(){return l.update()}),n.on("render",function(){return l.render()}),this.id=Math.random().toString(36).substring(2),r=this.layout.getNode(this.name),t=this.layout.getGroup(this.name),r.querySelector("[ld-each=legend]")||(r.innerHTML='<div class="pdlg '+this.dir+'">\n <div ld-each="legend">\n <div class="pdl-cell" ld="shape" data-only></div>\n <div class="pdl-cell" ld="text" data-only></div>\n </div>\n</div>'),t.querySelector("[ld-each=legend]")||(e=document.createElementNS(o,"g"),n=document.createElementNS(o,"g"),r=document.createElementNS(o,"g"),e.classList.add("pdlg-g"),e.setAttribute("ld-each","legend"),n.setAttribute("ld","shape"),r.setAttribute("ld","text"),e.appendChild(n),e.appendChild(r),t.appendChild(e)),this._func=[{key:"all",type:"func",text:"全選"},{key:"none",type:"func",text:"全不選"}],this.view={layout:new ldview({root:this.layout.getNode(this.name),initRender:!1,handler:{legend:{list:function(){return l._data.concat(l.cfg.selectable?l._func:[])},key:function(t){return t.key},view:{handler:{shape:function(t){var e=t.node,t=t.ctx;return e.setAttribute("data-name",l._name(t,"shape"))},text:function(t){var e=t.node,t=t.ctx;return e.setAttribute("data-name",l._name(t,"text")),e.innerText=t.text}}}}}}),render:new ldview({root:this.layout.getGroup(this.name),initRender:!1,handler:{legend:{list:function(){return l._data.concat(l.cfg.selectable?l._func:[])},key:function(t){return t.key},view:{action:{click:{"@":function(t){t.node;var e,n=t.ctx;if(l.cfg.selectable){if("func"===n.type)for(e in l._picked)l._picked[e]="all"===n.key;else l._picked[n.key]=!l._picked[n.key];return l.view.render.render("legend"),l.fire("select",l._picked)}}}},handler:{"@":function(t){var e=t.node,t=t.ctx;return e.style.opacity=!l.cfg.selectable||"func"===t.type||l._picked[t.key]?1:.3},shape:function(t){var e,n,r=t.node,i=t.ctx;if("func"!==i.type)return r.querySelector("circle")||r.appendChild(document.createElementNS(o,"circle")),e=r.querySelector("circle"),n=l.layout.getBox(l._name(i,"shape")),t=l.layout.getBox(l.name),e.setAttribute("cx",".5em"),e.setAttribute("cy",".5em"),e.setAttribute("r",".5em"),e.setAttribute("transform","translate("+(n.x-t.x)+", "+(n.y-t.y)+")"),"function"==typeof a.shape?a.shape.call(e,i):void 0;r.style.display="none"},text:function(t){var e=t.node,n=t.ctx,r=l.layout.getNode(l._name(n,"text")),t=l.layout.getBox(l._name(n,"text")),n=l.layout.getBox(l.name);return e.setAttribute("transform","translate("+(t.x-n.x)+", "+(t.y-n.y)+")"),e.textContent="",r=wrapSvgText({node:r,useRange:!0}),e.appendChild(r)}}}}}})},this.update(),this}).prototype=function(t,e){var n,r={}.hasOwnProperty;for(n in e)r.call(e,n)&&(t[n]=e[n]);return t}(Object.create(Object.prototype),{_name:function(t,e){return"pdlg-"+(e=null==e?"s":e)+"-"+this.id+"-"+(t.type||"")+"-"+t.key},enabled:function(){return this._data&&this._data.length&&(!(null!=this.cfg.enabled)||this.cfg.enabled)},update:function(){var t=this.enabled()?"":"0px",e=this.layout.getNode("legend").style;return e.width=t,e.height=t,e.padding=t,e.margin=t,this.view.layout.render()},render:function(){var t=this.enabled();if(this.layout.getGroup(this.name).style.display=t?"":"none",t)return this.view.render.render()},config:function(t){var e,n=this;return null==t?this.cfg:(this.cfg=t,this.dir="bottom"===this.cfg.position?"horizontal":"vertical",e=this.layout.getNode(this.name).querySelector(".pdlg"),["horizontal","vertical"].map(function(t){return e.classList.toggle(t,n.dir===t)}))},data:function(t){var n={};return(t=null==t?[]:t).map(function(t,e){return n[t.key]=e}),this._data=t.filter(function(t,e){return n[t.key]===e}),this._picked=Object.fromEntries(this._data.map(function(t){return[t.key,!0]})),this.update(),this.layout.update(!1),this.view.render.render()},on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,a=[],l=[],o=1,d=arguments.length;o<d;++o)l.push(arguments[o]);for(e=l,o=0,r=(n=this.evtHandler[t]||[]).length;o<r;++o)i=n[o],a.push(i.apply(this,e));return a},isSelected:function(t){return!!this._picked[t]}}),"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).legend=t)}.call(this);
File without changes
@@ -0,0 +1 @@
1
+ !function(){var s;(s=function(t){return this.isUnique=null==(t=null==t?{}:t).unique||t.unique,this.map={},this.nmap=[],this.wm=new WeakMap,this.count=0,this.set(t.palette)||t.colors,this}).default=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"],s.prototype=function(t,r){var n,s={}.hasOwnProperty;for(n in r)s.call(r,n)&&(t[n]=r[n]);return t}(Object.create(Object.prototype),{set:function(t,r){var n=this;return null==t&&(t=[]),null==r&&(r=!1),this.colors=Array.isArray(t)&&t.length?t:t.colors&&Array.isArray(t.colors)?t.colors:s.default,this.nmap=t.maps||[],this.colors=this.colors.map(function(t){return t.value||t}),1===this.colors.length&&this.colors.push(ldcolor.complement(this.colors[0])),this.colors=this.colors.map(function(t){return ldcolor.hsl(t)}),this.len=2<(t=this.colors.length)?t:2,r?this.reset():this.nmap.map(function(t,r){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,r)})})},unique:function(t){return null!=t?this.isUnique=!!t:this.isUnique},reset:function(){var n=this;return this.map={},this.wm=new WeakMap,this.count=0,(this.nmap||[]).map(function(t,r){return(Array.isArray(t)?t:[t]).map(function(t){return n.get(t,0,r)})})},get:function(t,r,n){var s,i,o,e,l,h,u,c;if(null==r&&(r=0),null!=n?(this.count<n&&(this.count=n+1),s=n%this.len,"object"==typeof t?this.wm.set(t,s):this.map[t]=s):("object"==typeof t?null==(s=this.wm.get(t))&&this.wm.set(t,s=this.count++):null==(s=this.map[t])&&(this.map[t]=s=this.count++),this.isUnique||(s%=this.len)),s>=this.len){for(c=s%(this.len-1),i=Math.floor(s/(this.len-1)),e=(o=[0,1])[0],l=o[1];0<i;)e=(o=[2*e,2*l])[0],l=o[1],i%2&&(e+=1),i>>=1;i=e/l,o=[this.colors[c],this.colors[1+c]],h=o[0],u=o[1],c={h:(o=["h","s","l"].map(function(t){return i*(u[t]-h[t])+h[t]}))[0],s:o[1],l:o[2]}}else c=this.colors[s];return 0<r?c=ldcolor.lighter(c,r):r<0&&(c=ldcolor.darker(c,-r)),ldcolor.web(c)},text:function(t,r){return null==r&&(r={}),t=ldcolor.hcl(this.get(t)),ldcolor.web(50<t.l?r.textDark||"#000":r.textLight||"#fff")}}),"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).tint=s)}.call(this);
@@ -107,7 +107,7 @@
107
107
  if (!this.enabled) {
108
108
  return;
109
109
  }
110
- this.view.setCtx(opt.data);
110
+ this.view.ctx(opt.data);
111
111
  this.view.render();
112
112
  rbox = this.root.getBoundingClientRect();
113
113
  nbox = opt.node != null
@@ -0,0 +1 @@
1
+ !function(){var t,e=function(t){var e,i=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.tip="string"==typeof t.node?this.root.querySelector(t.node):t.node,this.margin=null!=t.margin?t.margin:10,this.type="over"===t.type?"over":"move",this.accessor=t.accessor,this.range=t.range,this.zmgr=t.zmgr,this._z=0,this.enabled=!0,this.tip||(this.tip=document.createElement("div"),this.tip.innerHTML='<div ld="name" style="font-size:.85em"></div>\n<div ld="value" style="font-weight:bold;font-size:1.1em;line-height:1.2em"></div>',this.root.appendChild(this.tip),(e=this.tip.style).padding=".4em .5em",e.background="#13171a",e.color="#fff",e.borderRadius="3px",e.boxShadow="0 2px 4px rgba(0,0,0,.3)",e.lineHeight="1.2em",e.fontSize=".9em",e.maxWidth="10em",e.wordBreak="break-all"),(e=this.tip.style).position="absolute",e.zIndex=1,e.top=0,e.left=0,e.pointerEvents="none",e.userSelect="none",e.opacity=0,e.transition="opacity .15s ease-in-out"+("over"===this.type?", transform .15s ease-in-out":""),this.view=new ldview({root:this.tip,text:t.view||{name:function(t){t=t.ctx;return t?t.name:""},value:function(t){t=t.ctx;return t?t.value:""}}}),this.hide=debounce(3e3,function(){if(this.tip.style.opacity=0,this.zmgr)return this.zmgr.remove(this._z)}),this._evthdr={},this.accessor&&(this.root.addEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over=function(t){var e;if(t.target&&(e=i.accessor({evt:t})))return i.render({data:e,node:t.target,evt:t})}),this.root.addEventListener("mouseout",this._evthdr.out=function(){return i.hide().now()})),this};e.prototype=((t=Object.create(Object.prototype)).destroy=function(){if(this._evthdr.over&&this.root.removeEventListener("over"===this.type?"mouseover":"mousemove",this._evthdr.over),this._evthdr.out)return this.root.removeEventListener("mouseout",this._evthdr.out)},t.toggle=function(t){return null==t?this.enabled:this.enabled=t},t.render=function(t){var e,i,n,o,r,h,s,d,a;if(null==t&&(t={}),this.enabled)return this.view.ctx(t.data),this.view.render(),e=this.root.getBoundingClientRect(),h=null!=t.node?((s=t.node.getBoundingClientRect()).x=s.x-e.x,s.y=s.y-e.y,s):null!=t.box?t.box:{x:t.x,y:t.y,width:t.width,height:t.height},i=this.tip.getBoundingClientRect(),o=(n=[t.evt.clientX-e.x,t.evt.clientY-e.y])[0],a=n[1],d=this.margin,r=(n=[h.x+(null!=h.width?h.width/2:0),h.y+(null!=h.height?h.height/2:0)])[0],s=n[1],t=(n=[o-i.width/2,a-i.height/2])[0],h=n[1],t=(n=[t+(r<o?1:-1)*(d+i.width/2),h+(s<a?1:-1)*(d+i.height/2)])[0],h=n[1],t=(n=[((n=(t>(a=(s=this.range?this.range():e).x-e.x)?t:a)+i.width)<(d=s.width+s.x-e.x)?n:d)-i.width,((n=(h>(a=s.y-e.y)?h:a)+i.height)<(d=s.height+s.y-e.y)?n:d)-i.height])[0],h=n[1],(n=this.tip.style).transform="translate("+t+"px,"+h+"px)",n.opacity=1,n.zIndex=this._z=this.zmgr?this.zmgr.add(10):10,this.hide()},t),"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).tip=e)}.call(this);
package/dist/chart.css DELETED
@@ -1,8 +0,0 @@
1
- div[plug=layout] {
2
- width: 100%;
3
- height: 100%;
4
- }
5
- div[plug=layout] .pdl-layout {
6
- width: 100%;
7
- height: 100%;
8
- }
package/dist/chart.js DELETED
@@ -1,607 +0,0 @@
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);
@@ -1 +0,0 @@
1
- div[plug=layout]{width:100%;height:100%}div[plug=layout] .pdl-layout{width:100%;height:100%}
package/dist/chart.min.js DELETED
@@ -1 +0,0 @@
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);
package/dist/index.min.js DELETED
@@ -1 +0,0 @@
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);
@@ -1 +0,0 @@
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 +0,0 @@
1
- (function(){var config;config={preset:{default:{margin:{type:"number"},font:{size:{type:"number",min:1,max:256,step:1,default:16}},color:{type:"color"},palette:{type:"palette"},background:{type:"color"}}}};if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).config=config}}).call(this);
@@ -1 +0,0 @@
1
- (function(){var main;main={number:function(opt){var data,len;opt==null&&(opt={});data=opt.data.filter(function(it){return!(!it||(it+"").trim()==="")});len=data.filter(function(it){return!isNaN(parseFloat(it))}).length;return len/data.length},serial:function(opt){var data,hash,i$,to$,i,delta,k;opt==null&&(opt={});data=[].concat(opt.data);data.sort(function(a,b){return b-a});hash={};for(i$=1,to$=data.length;i$<to$;++i$){i=i$;if(isNaN(data[i])||isNaN(data[i-1])){hash[data[i]>data[i-1]?data[i]+":"+data[i-1]:data[i-1]+":"+data[i]]=true}else{delta=data[i]-data[i-1]}hash[delta]=true}return 1/(function(){var results$=[];for(k in hash){results$.push(k)}return results$}().filter(function(it){return it!=="0"}).length||2)},text:function(opt){opt==null&&(opt={});return 1-this.number(opt)},category:function(opt){var len,maxlen,ret,ref$,ref1$,ref2$;opt==null&&(opt={});len=Array.from(new Set(opt.data)).length;maxlen=opt.data.length;ret=(ref$=(ref1$=1-((ref2$=len-2)>0?ref2$:0)/maxlen-1/maxlen)>0?ref1$:0)<1?ref$:1;if(this.number(opt)){ret=ret*.9}return ret},parse:function(data){var head,body;if(Array.isArray(data)){head=data.slice(0,1)[0];body=data.slice(1);body=body.map(function(d,i){var ret;ret={};head.map(function(h,j){return ret[h]=d[j]});return ret});return{head:head,body:body}}return data},autotype:function(data){var head,res$,k,type,i$,len$,key,d,ret,list;data==null&&(data=[]);res$=[];for(k in data[0]||{}){res$.push(k)}head=res$;type=[];for(i$=0,len$=head.length;i$<len$;++i$){key=head[i$];d=data.map(fn$);ret={key:key,types:{R:main.number({data:d}),O:main.serial({data:d}),N:main.text({data:d}),C:main.category({data:d})}};list=["R","O","N","C"].map(fn1$);list.sort(fn2$);ret.type=list[0][0];type.push(ret)}return type;function fn$(it){return it[key]}function fn1$(it){return[it,ret.types[it]]}function fn2$(a,b){return b[1]-a[1]}},autobind:function(data,dimension){var datatypes,dims,k,v,i$,len$,dim,ts,j$,to$,i,t,k$,to1$,dt,ret;data==null&&(data=[]);dimension==null&&(dimension={});datatypes=this.autotype(data);dims=function(){var ref$,results$=[];for(k in ref$=dimension){v=ref$[k];results$.push({k:k,v:v})}return results$}().filter(function(it){return!it.v.passive});dims.sort(function(a,b){var ret,ref$,ma,mb;ret=(a.v.priority||100)-(b.v.priority||100);if(ret!==0){return ret}ref$=[a.v.type||"R",b.v.type||"R"].map(function(t){return Math.min.apply(Math,function(){var i$,to$,results$=[];for(i$=0,to$=t.length;i$<to$;++i$){results$.push(i$)}return results$}().map(function(i){return"CONR".indexOf(t[i])}))}),ma=ref$[0],mb=ref$[1];return ma-mb});for(i$=0,len$=dims.length;i$<len$;++i$){dim=dims[i$];dim.bind=null;ts=dim.v.type||"RNOC";for(j$=0,to$=ts.length;j$<to$;++j$){i=j$;t=ts[i];datatypes.sort(fn$);for(k$=0,to1$=datatypes.length;k$<to1$;++k$){i=k$;dt=datatypes[i];if(dt.types[t]<.5||dt.used||t==="C"&&dt.types.R>.5){continue}dim.bind=dim.v.multiple?[dt]:dt;dt.used=true;break}}}for(i$=0,len$=dims.length;i$<len$;++i$){dim=dims[i$];if(!dim.v.multiple){continue}ts=dim.v.type||"RNOC";for(j$=0,to$=ts.length;j$<to$;++j$){i=j$;t=ts[i];datatypes.sort(fn1$);for(k$=0,to1$=datatypes.length;k$<to1$;++k$){i=k$;dt=datatypes[i];if(dt.types[t]<.5||dt.used||t==="C"&&dt.types.R>.5){continue}dim.bind.push(dt);dt.used=true}}}ret={};for(i$=0,len$=dims.length;i$<len$;++i$){dim=dims[i$];if(dim.bind){ret[dim.k]=dim.bind;(Array.isArray(dim.bind)?dim.bind:[dim.bind]).map(fn2$)}}return ret;function fn$(a,b){var ret;ret=(b.types[t]||0)-(a.types[t]||0);if(b.types[t]===a.types[t]&&t==="R"){return(a.types.O||0)-(b.types.O||0)}return ret}function fn1$(a,b){var ret;ret=(b[t]||0)-(a[t]||0);if(b[t]===a[t]&&t==="R"){return(a.O||0)-(b.O||0)}return ret}function fn2$(it){var ref$;return ref$=it.used,delete it.used,ref$}}};if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).data=main}}).call(this);
@@ -1 +0,0 @@
1
- (function(){var format;format={};format.auto=function(list){var s,intRate,diffs,i,diffAvg,type,size;list==null&&(list=[]);return d3.format(".3s");list=list.map(function(it){return+it}).filter(function(it){return!isNaN(it)});if(!list.length){return d3.format("d")}list.sort(function(a,b){return a-b});s=Math.max.apply(Math,list.map(function(it){var s,ref$;s=1;while(it){if(it%10){break}it=Math.floor(it/10);s++}return(ref$=Math.ceil(Math.log(it||1)/Math.log(10)-s))>0?ref$:0}));intRate=list.filter(function(it){return Math.floor(it)===it}).length/list.length;diffs=function(){var i$,to$,results$=[];for(i$=1,to$=list.length;i$<to$;++i$){i=i$;results$.push(Math.abs(list[i]-list[i-1]))}return results$}().map(function(it){return Math.log(it?it:1)/Math.log(10)});diffAvg=diffs.reduce(function(a,b){return a+b},0)/list.length;type=intRate>.9?"s":"f";size=diffAvg>=0?s>0?s:0:Math.ceil(Math.abs(diffAvg));return d3.format("."+size+type)};format.simple=function(v){if(isNaN(v=+v)){return v}return v>=1e9?(v/1e9).toFixed(0)+"G":v>=1e6?(v/1e6).toFixed(0)+"M":v>=1e3?(v/1e3).toFixed(0)+"K":Math.floor(v)===v?v.toFixed(0):v.toFixed(2)};if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).format=format}}).call(this);
@@ -1 +0,0 @@
1
- (function(){var svgns,legend;svgns="http://www.w3.org/2000/svg";legend=function(opt){var x$,nodeLayout,nodeRender,gl,gs,gt,this$=this;opt==null&&(opt={});this._data=opt.data||[];this.name=opt.name||"legend";this.cfg=opt.cfg||{};this.root=typeof opt.root==="string"?document.querySelector(opt.root):opt.root;this.dir=opt.direction||"vertical";this.evtHandler={};this._picked=Object.fromEntries(this._data.map(function(it){return[it.key,true]}));this.layout=opt.layout||new layout({root:this.root});x$=this.layout;x$.on("update",function(){return this$.update()});x$.on("render",function(){return this$.render()});this.id=Math.random().toString(36).substring(2);nodeLayout=this.layout.getNode(this.name);nodeRender=this.layout.getGroup(this.name);if(!nodeLayout.querySelector("[ld-each=legend]")){nodeLayout.innerHTML='<div class="pdlg '+this.dir+'">\n <div ld-each="legend">\n <div class="pdl-cell" ld="shape" data-only></div>\n <div class="pdl-cell" ld="text" data-only></div>\n </div>\n</div>'}if(!nodeRender.querySelector("[ld-each=legend]")){gl=document.createElementNS(svgns,"g");gs=document.createElementNS(svgns,"g");gt=document.createElementNS(svgns,"g");gl.classList.add("pdlg-g");gl.setAttribute("ld-each","legend");gs.setAttribute("ld","shape");gt.setAttribute("ld","text");gl.appendChild(gs);gl.appendChild(gt);nodeRender.appendChild(gl)}this._func=[{key:"all",type:"func",text:"全選"},{key:"none",type:"func",text:"全不選"}];this.view={layout:new ldview({root:this.layout.getNode(this.name),initRender:false,handler:{legend:{list:function(){return this$._data.concat(this$.cfg.selectable?this$._func:[])},key:function(it){return it.key},view:{handler:{shape:function(arg$){var node,ctx;node=arg$.node,ctx=arg$.ctx;return node.setAttribute("data-name",this$._name(ctx,"shape"))},text:function(arg$){var node,ctx;node=arg$.node,ctx=arg$.ctx;node.setAttribute("data-name",this$._name(ctx,"text"));return node.innerText=ctx.text}}}}}}),render:new ldview({root:this.layout.getGroup(this.name),initRender:false,handler:{legend:{list:function(){return this$._data.concat(this$.cfg.selectable?this$._func:[])},key:function(it){return it.key},view:{action:{click:{"@":function(arg$){var node,ctx,k;node=arg$.node,ctx=arg$.ctx;if(!this$.cfg.selectable){return}if(ctx.type==="func"){for(k in this$._picked){this$._picked[k]=ctx.key==="all"?true:false}}else{this$._picked[ctx.key]=!this$._picked[ctx.key]}this$.view.render.render("legend");return this$.fire("select",this$._picked)}}},handler:{"@":function(arg$){var node,ctx;node=arg$.node,ctx=arg$.ctx;return node.style.opacity=!this$.cfg.selectable||ctx.type==="func"||this$._picked[ctx.key]?1:.3},shape:function(arg$){var node,ctx,n,box,rbox;node=arg$.node,ctx=arg$.ctx;if(ctx.type==="func"){node.style.display="none";return}if(!node.querySelector("circle")){node.appendChild(document.createElementNS(svgns,"circle"))}n=node.querySelector("circle");box=this$.layout.getBox(this$._name(ctx,"shape"));rbox=this$.layout.getBox(this$.name);n.setAttribute("cx",".5em");n.setAttribute("cy",".5em");n.setAttribute("r",".5em");n.setAttribute("transform","translate("+(box.x-rbox.x)+", "+(box.y-rbox.y)+")");if(typeof opt.shape==="function"){return opt.shape.call(n,ctx)}},text:function(arg$){var node,ctx,n,nbox,rbox,ret;node=arg$.node,ctx=arg$.ctx;n=this$.layout.getNode(this$._name(ctx,"text"));nbox=this$.layout.getBox(this$._name(ctx,"text"));rbox=this$.layout.getBox(this$.name);node.setAttribute("transform","translate("+(nbox.x-rbox.x)+", "+(nbox.y-rbox.y)+")");node.textContent="";ret=wrapSvgText({node:n,useRange:true});return node.appendChild(ret)}}}}}})};this.update();return this};legend.prototype=import$(Object.create(Object.prototype),{_name:function(ctx,type){type==null&&(type="s");return"pdlg-"+type+"-"+this.id+"-"+(ctx.type||"")+"-"+ctx.key},enabled:function(){return this._data&&this._data.length&&(!(this.cfg.enabled!=null)||this.cfg.enabled)},update:function(){var val,ref$;val=this.enabled()?"":"0px";ref$=this.layout.getNode("legend").style;ref$.width=val;ref$.height=val;ref$.padding=val;ref$.margin=val;return this.view.layout.render()},render:function(){var enabled,g;enabled=this.enabled();g=this.layout.getGroup(this.name);g.style.display=enabled?"":"none";if(enabled){return this.view.render.render()}},config:function(cfg){var node,this$=this;if(!(cfg!=null)){return this.cfg}this.cfg=cfg;this.dir=this.cfg.position==="bottom"?"horizontal":"vertical";node=this.layout.getNode(this.name).querySelector(".pdlg");return["horizontal","vertical"].map(function(it){return node.classList.toggle(it,this$.dir===it)})},data:function(data){var hash;data==null&&(data=[]);hash={};data.map(function(d,i){return hash[d.key]=i});this._data=data.filter(function(d,i){return hash[d.key]===i});this._picked=Object.fromEntries(this._data.map(function(d){return[d.key,true]}));this.update();this.layout.update(false);return this.view.render.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$},isSelected:function(key){return!!this._picked[key]}});if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).legend=legend}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 +0,0 @@
1
- (function(){var tint;tint=function(opt){opt==null&&(opt={});this.isUnique=opt.unique!=null?opt.unique:true;this.map={};this.nmap=[];this.wm=new WeakMap;this.count=0;this.set(opt.palette)||opt.colors;return this};tint["default"]=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"];tint.prototype=import$(Object.create(Object.prototype),{set:function(pal,reset){var ref$,this$=this;pal==null&&(pal=[]);reset==null&&(reset=false);this.colors=Array.isArray(pal)&&pal.length?pal:pal.colors&&Array.isArray(pal.colors)?pal.colors:tint["default"];this.nmap=pal.maps||[];this.colors=this.colors.map(function(it){return it.value||it});if(this.colors.length===1){this.colors.push(ldcolor.complement(this.colors[0]))}this.colors=this.colors.map(function(it){return ldcolor.hsl(it)});this.len=(ref$=this.colors.length)>2?ref$:2;if(reset){return this.reset()}else{return this.nmap.map(function(d,i){return(Array.isArray(d)?d:[d]).map(function(it){return this$.get(it,0,i)})})}},unique:function(it){return it!=null?this.isUnique=!!it:this.isUnique},reset:function(){var this$=this;this.map={};this.wm=new WeakMap;this.count=0;return(this.nmap||[]).map(function(d,i){return(Array.isArray(d)?d:[d]).map(function(it){return this$.get(it,0,i)})})},get:function(data,variant,idx){var val,seg,pos,ref$,fz,fm,c1,c2,h,s,l,ret;variant==null&&(variant=0);if(idx!=null){if(this.count<idx){this.count=idx+1}val=idx%this.len;if(typeof data==="object"){this.wm.set(data,val)}else{this.map[data]=val}}else{if(typeof data==="object"){if((val=this.wm.get(data))==null){this.wm.set(data,val=this.count++)}}else if((val=this.map[data])==null){this.map[data]=val=this.count++}if(!this.isUnique){val=val%this.len}}if(val>=this.len){seg=val%(this.len-1);pos=Math.floor(val/(this.len-1));ref$=[0,1],fz=ref$[0],fm=ref$[1];while(pos>0){ref$=[fz*2,fm*2],fz=ref$[0],fm=ref$[1];if(pos%2){fz+=1}pos=pos>>1}pos=fz/fm;ref$=[this.colors[seg],this.colors[seg+1]],c1=ref$[0],c2=ref$[1];ref$=["h","s","l"].map(function(k){return pos*(c2[k]-c1[k])+c1[k]}),h=ref$[0],s=ref$[1],l=ref$[2];ret={h:h,s:s,l:l}}else{ret=this.colors[val]}if(variant>0){ret=ldcolor.lighter(ret,variant)}else if(variant<0){ret=ldcolor.darker(ret,-variant)}return ldcolor.web(ret)},text:function(v,opt){var hcl;opt==null&&(opt={});hcl=ldcolor.hcl(this.get(v));return ldcolor.web(hcl.l>50?opt.textDark||"#000":opt.textLight||"#fff")}});if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).tint=tint}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 +0,0 @@
1
- (function(){var tip,ref$;tip=function(opt){var ref$,this$=this;opt==null&&(opt={});this.root=typeof opt.root==="string"?document.querySelector(opt.root):opt.root;this.tip=typeof opt.node==="string"?this.root.querySelector(opt.node):opt.node;this.margin=opt.margin!=null?opt.margin:10;this.type=opt.type==="over"?"over":"move";this.accessor=opt.accessor;this.range=opt.range;this.zmgr=opt.zmgr;this._z=0;this.enabled=true;if(!this.tip){this.tip=document.createElement("div");this.tip.innerHTML='<div ld="name" style="font-size:.85em"></div>\n<div ld="value" style="font-weight:bold;font-size:1.1em;line-height:1.2em"></div>';this.root.appendChild(this.tip);ref$=this.tip.style;ref$.padding=".4em .5em";ref$.background="#13171a";ref$.color="#fff";ref$.borderRadius="3px";ref$.boxShadow="0 2px 4px rgba(0,0,0,.3)";ref$.lineHeight="1.2em";ref$.fontSize=".9em";ref$.maxWidth="10em";ref$.wordBreak="break-all"}ref$=this.tip.style;ref$.position="absolute";ref$.zIndex=1;ref$.top=0;ref$.left=0;ref$.pointerEvents="none";ref$.userSelect="none";ref$.opacity=0;ref$.transition="opacity .15s ease-in-out"+(this.type==="over"?", transform .15s ease-in-out":"");this.view=new ldview({root:this.tip,text:opt.view||{name:function(arg$){var ctx;ctx=arg$.ctx;if(ctx){return ctx.name}else{return""}},value:function(arg$){var ctx;ctx=arg$.ctx;if(ctx){return ctx.value}else{return""}}}});this.hide=debounce(3e3,function(){this.tip.style.opacity=0;if(this.zmgr){return this.zmgr.remove(this._z)}});this._evthdr={};if(this.accessor){this.root.addEventListener(this.type==="over"?"mouseover":"mousemove",this._evthdr.over=function(e){var data;if(!(e.target&&(data=this$.accessor({evt:e})))){return}return this$.render({data:data,node:e.target,evt:e})});this.root.addEventListener("mouseout",this._evthdr.out=function(){return this$.hide().now()})}return this};tip.prototype=(ref$=Object.create(Object.prototype),ref$.destroy=function(){if(this._evthdr.over){this.root.removeEventListener(this.type==="over"?"mouseover":"mousemove",this._evthdr.over)}if(this._evthdr.out){return this.root.removeEventListener("mouseout",this._evthdr.out)}},ref$.toggle=function(it){return!(it!=null)?this.enabled:this.enabled=it},ref$.render=function(opt){var rbox,nbox,ret,tbox,ref$,mx,my,m,nx,ny,tx,ty,rangeBox,ref1$,ref2$;opt==null&&(opt={});if(!this.enabled){return}this.view.setCtx(opt.data);this.view.render();rbox=this.root.getBoundingClientRect();nbox=opt.node!=null?(ret=opt.node.getBoundingClientRect(),ret.x=ret.x-rbox.x,ret.y=ret.y-rbox.y,ret):opt.box!=null?opt.box:{x:opt.x,y:opt.y,width:opt.width,height:opt.height};tbox=this.tip.getBoundingClientRect();ref$=[opt.evt.clientX-rbox.x,opt.evt.clientY-rbox.y],mx=ref$[0],my=ref$[1];m=this.margin;ref$=[nbox.x+(nbox.width!=null?nbox.width/2:0),nbox.y+(nbox.height!=null?nbox.height/2:0)],nx=ref$[0],ny=ref$[1];ref$=[mx-tbox.width/2,my-tbox.height/2],tx=ref$[0],ty=ref$[1];ref$=[tx+(nx<mx?1:-1)*(m+tbox.width/2),ty+(ny<my?1:-1)*(m+tbox.height/2)],tx=ref$[0],ty=ref$[1];rangeBox=this.range?rangeBox=this.range():rbox;ref$=[((ref$=(tx>(ref2$=rangeBox.x-rbox.x)?tx:ref2$)+tbox.width)<(ref1$=rangeBox.width+rangeBox.x-rbox.x)?ref$:ref1$)-tbox.width,((ref$=(ty>(ref2$=rangeBox.y-rbox.y)?ty:ref2$)+tbox.height)<(ref1$=rangeBox.height+rangeBox.y-rbox.y)?ref$:ref1$)-tbox.height],tx=ref$[0],ty=ref$[1];ref$=this.tip.style;ref$.transform="translate("+tx+"px,"+ty+"px)";ref$.opacity=1;ref$.zIndex=this._z=!this.zmgr?10:this.zmgr.add(10);return this.hide()},ref$);if(typeof chart!="undefined"&&chart!==null){(chart.utils||(chart.utils={})).tip=tip}}).call(this);