@plotdb/chart 2.1.13 → 2.1.15

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Change Logs
2
2
 
3
+ ## v2.1.15
4
+
5
+ - pie chart: correctly support different legend position
6
+ - percent-list: make label also selectable ( with event )
7
+ - init `data` field with an empty array so we will have a dummy data even if parse failed to run.
8
+ - audit fix to fix dependencies vulnerabilities
9
+
10
+
11
+ ## v2.1.14
12
+
13
+ - utils.tip: add `group` handler
14
+ - bubble chart: show `group` in tip
15
+
16
+
3
17
  ## v2.1.13
4
18
 
5
19
  - bubble chart:
package/index.js CHANGED
@@ -231,6 +231,7 @@
231
231
  return null;
232
232
  }
233
233
  };
234
+ this.data = [];
234
235
  this.raw = opt.raw || null;
235
236
  this.mod = opt.mod || {};
236
237
  this.cfg = opt.config || {};
package/index.min.js CHANGED
@@ -1 +1 @@
1
- !function(){var n,r,o,s,u,a,t;function l(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}n=function(t,e,n){for(var i=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=i;t&&t!==n&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(r=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 i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,i=(n=this.evtHandler[t]||[]).length;u<i;++u)r=n[u],o.push(r.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,i=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 i.handler(t,!1)})}}),o={list:[],init:function(){var t,n,i=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 i.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,i;for(n in e)i=e[n],null==t[n]?t[n]=i:"object"==typeof t[n]&&"object"==typeof i&&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,i,r;for(i in null==e&&(e={}),n=t.child,t)(r=t[i]).type?r.default&&(e[i]=r.default):o(r,e[i]||(e[i]={}));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||{},t.binding&&this._normalizeBinding(),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,i=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 r,o.add(this._aniloop),this._aniloop.on("tick",function(){return i.tick()}),Promise.resolve().then(function(){var t;if(i._defcfg=t=a(i.mod.config||{}),u(i.cfg,t),(!i.raw||!Array.isArray(i.raw))&&i.useSample&&i.mod.sample)return(t=i.mod.sample.apply(i)).then?t.then():Promise.resolve(t)}).then(function(t){return i.raw=(t=t||{}).raw,i.binding=t.binding,i}).then(function(){var t,e;if(i.raw||(i.raw=[]),i.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")),i.layout=new layout("object"==typeof i.layoutOpt?((t=l({},i.layoutOpt)).watchResize=!1,t):{root:n,watchResize:!1}))),e=proxise(function(){return s.add(i.root,i),null}),!i.forceInit&&i.root.offsetParent&&"none"!==window.getComputedStyle(i.root).display)return i._resize=function(){return e.resolve()},e()}).then(function(){return i._resize=function(){}}).then(function(){var t,e=function(){if(i.mod.init)return i.mod.init.apply(i)};return i.layout?(t=proxise(function(){return Promise.resolve(i.layout.init(e)),null}),i._layout=function(){return t.resolve()},i.layout.on("render",function(){return i._layout()}),t()):e()}).then(function(){i._layout=function(){},Promise.resolve().then(function(){if(i.delayRender)return i.renderLock=proxise(function(){}),i.renderLock()}).then(function(){return i._resize=function(){return i.resize(),i.render()},i._layout=function(){return i.parse(),i.bind(),i.resize(),i.render()},i.parse(),i.bind(),i.resize(),i.render()})})},parse:function(){var t,l=(t=this.mod).dimension||(t.dimension={}),h=this.binding;if(this.data=this.raw.map(function(e,t){var n,i,r,o,s={};for(n in i=l)r=i[n],(o=h[n])?(s[n]=r.multiple?(o.map?o:[o]).map(u):e[o.key],/[RIT]/.exec(r.type)&&!/[CN]/.exec(r.type)&&(s[n]=Array.isArray(s[n])?s[n].map(a):parseFloat(s[n]))):r.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function u(t){return e[t.key]}function a(t){return parseFloat(t)}}),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(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)u(t,arguments[e]);return u(t,this._defcfg),l(this.cfg,t)},_normalizeBinding:function(t){var e,n,i,r,o,s,u,a=[];if(null==t){for(t in e=[],this.binding)e.push(t);t=e}for(n=0,i=(t=!Array.isArray(t)?[t]:t).length;n<i;++n)r=t[n],o=(this.mod.dimension||{})[r]||{},s=this.binding[r],u=Array.isArray(s),!o.multiple!=!u&&(o.multiple||u)&&a.push(this.binding[r]=u?s[0]:s?[s]:[]);return a},setBind:function(t,e){return this.binding[t]=e,this._normalizeBinding([t]),this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var i;return null==n&&(n=!1),Array.isArray(t)||(t=(i=t).raw,e=i.binding,n=i.reinit),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),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 i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,i=(n=this.evtHandler[t]||[]).length;u<i;++u)r=n[u],o.push(r.apply(this,e));return o},filter:function(t,e){var n,i,r,o,s;for(i in null==t&&(t={}),null==e&&(e=!1),n=[],r=this.binding)o=r[i],s=(s=Array.isArray(o)?o:[o]).map(u),n=n.concat(s);for(i in t)o=t[i],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:i,v:t}}function a(t){return t.k===i}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);
1
+ !function(){var n,r,o,s,u,a,t;function l(t,e){var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t}n=function(t,e,n){for(var i=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=i;t&&t!==n&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(r=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 i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,i=(n=this.evtHandler[t]||[]).length;u<i;++u)r=n[u],o.push(r.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,i=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 i.handler(t,!1)})}}),o={list:[],init:function(){var t,n,i=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 i.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,i;for(n in e)i=e[n],null==t[n]?t[n]=i:"object"==typeof t[n]&&"object"==typeof i&&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,i,r;for(i in null==e&&(e={}),n=t.child,t)(r=t[i]).type?r.default&&(e[i]=r.default):o(r,e[i]||(e[i]={}));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.data=[],this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},t.binding&&this._normalizeBinding(),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,i=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 r,o.add(this._aniloop),this._aniloop.on("tick",function(){return i.tick()}),Promise.resolve().then(function(){var t;if(i._defcfg=t=a(i.mod.config||{}),u(i.cfg,t),(!i.raw||!Array.isArray(i.raw))&&i.useSample&&i.mod.sample)return(t=i.mod.sample.apply(i)).then?t.then():Promise.resolve(t)}).then(function(t){return i.raw=(t=t||{}).raw,i.binding=t.binding,i}).then(function(){var t,e;if(i.raw||(i.raw=[]),i.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")),i.layout=new layout("object"==typeof i.layoutOpt?((t=l({},i.layoutOpt)).watchResize=!1,t):{root:n,watchResize:!1}))),e=proxise(function(){return s.add(i.root,i),null}),!i.forceInit&&i.root.offsetParent&&"none"!==window.getComputedStyle(i.root).display)return i._resize=function(){return e.resolve()},e()}).then(function(){return i._resize=function(){}}).then(function(){var t,e=function(){if(i.mod.init)return i.mod.init.apply(i)};return i.layout?(t=proxise(function(){return Promise.resolve(i.layout.init(e)),null}),i._layout=function(){return t.resolve()},i.layout.on("render",function(){return i._layout()}),t()):e()}).then(function(){i._layout=function(){},Promise.resolve().then(function(){if(i.delayRender)return i.renderLock=proxise(function(){}),i.renderLock()}).then(function(){return i._resize=function(){return i.resize(),i.render()},i._layout=function(){return i.parse(),i.bind(),i.resize(),i.render()},i.parse(),i.bind(),i.resize(),i.render()})})},parse:function(){var t,l=(t=this.mod).dimension||(t.dimension={}),h=this.binding;if(this.data=this.raw.map(function(e,t){var n,i,r,o,s={};for(n in i=l)r=i[n],(o=h[n])?(s[n]=r.multiple?(o.map?o:[o]).map(u):e[o.key],/[RIT]/.exec(r.type)&&!/[CN]/.exec(r.type)&&(s[n]=Array.isArray(s[n])?s[n].map(a):parseFloat(s[n]))):r.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function u(t){return e[t.key]}function a(t){return parseFloat(t)}}),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(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)u(t,arguments[e]);return u(t,this._defcfg),l(this.cfg,t)},_normalizeBinding:function(t){var e,n,i,r,o,s,u,a=[];if(null==t){for(t in e=[],this.binding)e.push(t);t=e}for(n=0,i=(t=!Array.isArray(t)?[t]:t).length;n<i;++n)r=t[n],o=(this.mod.dimension||{})[r]||{},s=this.binding[r],u=Array.isArray(s),!o.multiple!=!u&&(o.multiple||u)&&a.push(this.binding[r]=u?s[0]:s?[s]:[]);return a},setBind:function(t,e){return this.binding[t]=e,this._normalizeBinding([t]),this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var i;return null==n&&(n=!1),Array.isArray(t)||(t=(i=t).raw,e=i.binding,n=i.reinit),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),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 i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,i=(n=this.evtHandler[t]||[]).length;u<i;++u)r=n[u],o.push(r.apply(this,e));return o},filter:function(t,e){var n,i,r,o,s;for(i in null==t&&(t={}),null==e&&(e=!1),n=[],r=this.binding)o=r[i],s=(s=Array.isArray(o)?o:[o]).map(u),n=n.concat(s);for(i in t)o=t[i],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:i,v:t}}function a(t){return t.k===i}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 +1 @@
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.1.13","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","@xlfont/choose":"^0.0.13","@xlfont/load":"^2.1.0","@zbryikt/template":"^2.3.38","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","fedep":"^1.1.7","ldbutton":"^2.0.1","ldfile":"^2.0.0","ldiconfont":"^0.2.3","ldloader":"^3.0.1","ldview":"^1.2.1","livescript":"^1.6.0","pdmaptw":"2.1.0","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","@xlfont/choose","@xlfont/load","@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","ldfile","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@loadingio/ldcolorpicker":"^3.0.0","@plotdb/block":"^4.7.1","@plotdb/csscope":"^4.0.6","@plotdb/konfig":"^4.7.2","@plotdb/rescope":"^4.1.6","@zbryikt/voronoijs":"^1.0.0","choosefont.js":"^0.0.1","d3":"^4.13.0","d3-array":"^3.1.1","d3-axis":"^3.0.0","d3-brush":"^3.0.0","d3-color":"^3.1.0","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","ldcolor":"^1.0.0","ldcover":"^3.2.1","ldpalettepicker":"^4.0.1","ldslider":"^3.1.1","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}
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.1.15","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","@xlfont/choose":"^0.0.13","@xlfont/load":"^2.1.0","@zbryikt/template":"^2.3.38","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","fedep":"^1.1.7","ldbutton":"^2.0.1","ldfile":"^2.0.0","ldiconfont":"^0.2.3","ldloader":"^3.0.1","ldview":"^1.2.1","livescript":"^1.6.0","pdmaptw":"2.1.0","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","@xlfont/choose","@xlfont/load","@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","ldfile","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@loadingio/ldcolorpicker":"^3.0.0","@plotdb/block":"^4.7.1","@plotdb/csscope":"^4.0.6","@plotdb/konfig":"^4.7.2","@plotdb/rescope":"^4.1.6","@zbryikt/voronoijs":"^1.0.0","choosefont.js":"^0.0.1","d3":"^4.13.0","d3-array":"^3.1.1","d3-axis":"^3.0.0","d3-brush":"^3.0.0","d3-color":"^3.1.0","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","ldcolor":"^1.0.0","ldcover":"^3.2.1","ldpalettepicker":"^4.0.1","ldslider":"^3.1.1","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}
package/utils/tip.js CHANGED
@@ -18,7 +18,7 @@
18
18
  this.enabled = true;
19
19
  if (!this.tip) {
20
20
  this.tip = document.createElement('div');
21
- 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>";
21
+ this.tip.innerHTML = "<div ld=\"group\" style=\"font-size:.75em\"></div>\n<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>";
22
22
  this.root.appendChild(this.tip);
23
23
  ref$ = this.tip.style;
24
24
  ref$.padding = '.4em .5em';
@@ -43,6 +43,15 @@
43
43
  this.view = new ldview({
44
44
  root: this.tip,
45
45
  text: opt.view || {
46
+ group: function(arg$){
47
+ var ctx;
48
+ ctx = arg$.ctx;
49
+ if (ctx) {
50
+ return ctx.group;
51
+ } else {
52
+ return '';
53
+ }
54
+ },
46
55
  name: function(arg$){
47
56
  var ctx;
48
57
  ctx = arg$.ctx;
package/utils/tip.min.js CHANGED
@@ -1 +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);
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="group" style="font-size:.75em"></div>\n<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||{group:function(t){t=t.ctx;return t?t.group:""},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);