Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3kit

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3kit - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

4

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change logs

### 3.1.0
Change from using `DEFAULT_OPTIONS` variable to store default options to static function `.getDefaultOptions()` that creates and returns a new Object. This resolve issues when the value in the options is not plain Object (for example, a scale) and multiple chart instances try to access and modify the default value (scale).
### 3.0.0

@@ -7,0 +11,0 @@

59

dist/d3kit-es.js

@@ -1052,2 +1052,20 @@ import { select } from 'd3-selection';

createClass(AbstractChart, null, [{
key: 'getDefaultOptions',
value: function getDefaultOptions() {
return {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30
},
offset: {
x: 0.5,
y: 0.5
}
};
}
}, {
key: 'getCustomEventNames',

@@ -1066,3 +1084,3 @@ value: function getCustomEventNames() {

var mergedOptions = deepExtend.apply(undefined, [{}, AbstractChart.DEFAULT_OPTIONS].concat(options));
var mergedOptions = deepExtend.apply(undefined, [this.constructor.getDefaultOptions()].concat(options));

@@ -1361,17 +1379,2 @@ this._state = {

AbstractChart.DEFAULT_OPTIONS = {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30
},
offset: {
x: 0.5,
y: 0.5
}
};
AbstractChart.DEFAULT_EVENTS = ['data', 'options', 'resize'];

@@ -1382,5 +1385,7 @@

createClass(CanvasChart, null, [{
key: 'getCustomEventNames',
value: function getCustomEventNames() {
return [];
key: 'getDefaultOptions',
value: function getDefaultOptions() {
return deepExtend(get(Object.getPrototypeOf(CanvasChart), 'getDefaultOptions', this).call(this), {
pixelRatio: window.devicePixelRatio
});
}

@@ -1398,3 +1403,3 @@ }]);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector].concat(options)));

@@ -1453,6 +1458,2 @@ _this.canvas = _this.container.append('canvas');

CanvasChart.DEFAULT_OPTIONS = {
pixelRatio: window.devicePixelRatio
};
// EXAMPLE USAGE:

@@ -1551,8 +1552,2 @@ //

inherits(SvgChart, _AbstractChart);
createClass(SvgChart, null, [{
key: 'getCustomEventNames',
value: function getCustomEventNames() {
return [];
}
}]);

@@ -1568,3 +1563,3 @@ function SvgChart(selector) {

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector].concat(options)));

@@ -1603,4 +1598,2 @@ _this.svg = _this.container.append('svg');

SvgChart.DEFAULT_OPTIONS = {};
export { helper, AbstractChart, CanvasChart, SvgChart, LayerOrganizer };

@@ -1055,2 +1055,20 @@ (function (global, factory) {

createClass(AbstractChart, null, [{
key: 'getDefaultOptions',
value: function getDefaultOptions() {
return {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30
},
offset: {
x: 0.5,
y: 0.5
}
};
}
}, {
key: 'getCustomEventNames',

@@ -1069,3 +1087,3 @@ value: function getCustomEventNames() {

var mergedOptions = deepExtend.apply(undefined, [{}, AbstractChart.DEFAULT_OPTIONS].concat(options));
var mergedOptions = deepExtend.apply(undefined, [this.constructor.getDefaultOptions()].concat(options));

@@ -1364,17 +1382,2 @@ this._state = {

AbstractChart.DEFAULT_OPTIONS = {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30
},
offset: {
x: 0.5,
y: 0.5
}
};
AbstractChart.DEFAULT_EVENTS = ['data', 'options', 'resize'];

@@ -1385,5 +1388,7 @@

createClass(CanvasChart, null, [{
key: 'getCustomEventNames',
value: function getCustomEventNames() {
return [];
key: 'getDefaultOptions',
value: function getDefaultOptions() {
return deepExtend(get(Object.getPrototypeOf(CanvasChart), 'getDefaultOptions', this).call(this), {
pixelRatio: window.devicePixelRatio
});
}

@@ -1401,3 +1406,3 @@ }]);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector].concat(options)));

@@ -1456,6 +1461,2 @@ _this.canvas = _this.container.append('canvas');

CanvasChart.DEFAULT_OPTIONS = {
pixelRatio: window.devicePixelRatio
};
// EXAMPLE USAGE:

@@ -1554,8 +1555,2 @@ //

inherits(SvgChart, _AbstractChart);
createClass(SvgChart, null, [{
key: 'getCustomEventNames',
value: function getCustomEventNames() {
return [];
}
}]);

@@ -1571,3 +1566,3 @@ function SvgChart(selector) {

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector].concat(options)));

@@ -1606,4 +1601,2 @@ _this.svg = _this.container.append('svg');

SvgChart.DEFAULT_OPTIONS = {};
exports.helper = helper;

@@ -1610,0 +1603,0 @@ exports.AbstractChart = AbstractChart;

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch"],e):e(t.d3Kit=t.d3Kit||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function i(t){var e="undefined"==typeof t?"undefined":E(t);return null!=t&&("object"==e||"function"==e)}function r(t){var e=i(t)?M.call(t):"";return e==I||e==P||e==C}function s(t){return null!=t&&"object"==("undefined"==typeof t?"undefined":E(t))}function a(t){return"symbol"==("undefined"==typeof t?"undefined":E(t))||s(t)&&G.call(t)==H}function o(t){if("number"==typeof t)return t;if(a(t))return $;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(q,"");var n=K.test(t);return n||V.test(t)?Z(t.slice(2),n?2:8):B.test(t)?$:+t}function h(t,e,n){function r(e){var n=g,i=v;return g=v=void 0,w=e,m=t.apply(i,n)}function s(t){return w=t,y=setTimeout(u,e),O?r(t):m}function a(t){var n=t-_,i=t-w,r=e-n;return b?X(r,p-i):r}function h(t){var n=t-_,i=t-w;return void 0===_||n>=e||0>n||b&&i>=p}function u(){var t=z();return h(t)?c(t):void(y=setTimeout(u,a(t)))}function c(t){return y=void 0,k&&g?r(t):(g=v=void 0,m)}function f(){void 0!==y&&clearTimeout(y),w=0,g=_=v=y=void 0}function l(){return void 0===y?m:c(z())}function d(){var t=z(),n=h(t);if(g=arguments,v=this,_=t,n){if(void 0===y)return s(_);if(b)return y=setTimeout(u,e),r(_)}return void 0===y&&(y=setTimeout(u,e)),m}var g,v,p,m,y,_,w=0,O=!1,b=!1,k=!0;if("function"!=typeof t)throw new TypeError(J);return e=o(e)||0,i(n)&&(O=!!n.leading,b="maxWait"in n,p=b?Q(o(n.maxWait)||0,e):p,k="trailing"in n?!!n.trailing:k),d.cancel=f,d.flush=l,d}function u(t,e,n){var r=!0,s=!0;if("function"!=typeof t)throw new TypeError(Y);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),h(t,e,{leading:r,maxWait:e,trailing:s})}function c(t){return null==t?"":String(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(t){return null==t?"\\s":t.source?t.source:"["+c(t)+"]"}function l(t,e){if(null==t)return"";if(!e&&tt)return tt.call(t);var n=f(e),i=new RegExp("^"+n+"+|"+n+"+$","g");return String(t).replace(i,"")}function d(t){return l(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}function g(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var s in n)if(n.hasOwnProperty(s)){var a=n[s];t[s]=!i(a)||Array.isArray(a)||r(a)?a:g(t[s],a)}}return t}function v(t){t=t||{};for(var e=1;e<arguments.length;e++)if(arguments[e])for(var n in arguments[e])arguments[e].hasOwnProperty(n)&&(t[n]=arguments[e][n]);return t}function p(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function m(t,e){for(var n=1,i=arguments.length,r=void 0;++n<i;)t[r=arguments[n]]=p(t,e,e[r]);return t}function y(t){return r(t)?t:function(){return t}}function _(t){throw new Error("Missing parameter "+t)}function w(t){return null!==t&&void 0!==t}function O(t){return null===t||void 0===t}function b(t){return!(!t||1!==t.nodeType)}function k(t){if(O(t))return function(t,e){return Math.min(t,e)};var e=(""+t).trim().toLowerCase();if(e.indexOf("%")>-1){var n=function(){var t=+e.replace("%","")/100;return{v:function(e,n){return n*t}}}();if("object"===("undefined"==typeof n?"undefined":E(n)))return n.v}return function(){return+e.replace("px","")}}function D(t){function e(t,e){var n=arguments.length<=2||void 0===arguments[2]?"":arguments[2],i=e.split("."),r=void 0,s=void 0;i.length>1?(s=i[0].length>0?i[0]:h,r=i[1]):(s=h,r=i[0]);var a=""+n+r;if(u.hasOwnProperty(a))throw new Error("invalid or duplicate layer id: "+a);var o=d(r)+"-layer",c=t.append(s).classed(o,!0);return u[a]=c,c}function n(t,r){var s=arguments.length<=2||void 0===arguments[2]?"":arguments[2];if(Array.isArray(r))return r.map(function(e){return n(t,e,s)});if(i(r)){var a=Object.keys(r),o=N(a,1),h=o[0],u=e(t,h,s);return n(u,r[h],""+s+h+"/"),u}return e(t,r,s)}function r(e){return n(t,e)}function s(t){return Array.isArray(t)?t.map(r):r(t)}function a(t){return u[t]}function o(t){return!!u[t]}var h=arguments.length<=1||void 0===arguments[1]?"g":arguments[1],u={};return{create:s,get:a,has:o}}var E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},A=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},T=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),j=function ut(t,e,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,e);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:ut(r,e,n)}if("value"in i)return i.value;var s=i.get;return void 0===s?void 0:s.call(n)},x=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},W=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},N=function(){function t(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var a,o=t[Symbol.iterator]();!(i=(a=o.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(h){r=!0,s=h}finally{try{!i&&o["return"]&&o["return"]()}finally{if(r)throw s}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),I="[object Function]",P="[object GeneratorFunction]",C="[object Proxy]",S=Object.prototype,M=S.toString,F="object"==("undefined"==typeof global?"undefined":E(global))&&global&&global.Object===Object&&global,L="object"==("undefined"==typeof self?"undefined":E(self))&&self&&self.Object===Object&&self,R=F||L||Function("return this")(),z=function(){return R.Date.now()},H="[object Symbol]",U=Object.prototype,G=U.toString,$=0/0,q=/^\s+|\s+$/g,B=/^[-+]0x[0-9a-f]+$/i,K=/^0b[01]+$/i,V=/^0o[0-7]+$/i,Z=parseInt,J="Expected a function",Q=Math.max,X=Math.min,Y="Expected a function",tt=String.prototype.trim,et=Object.freeze({isObject:i,isFunction:r,kebabCase:d,deepExtend:g,extend:v,rebind:m,functor:y,debounce:h,throttle:u}),nt=function(){function t(){A(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];if(1===n.length){var s=n[0],a=r(s)?s():s;if(a instanceof t)this.width=a.width,this.height=a.height;else if(b(a))this.width=a.clientWidth,this.height=a.clientHeight;else if(Array.isArray(a))this.width=a[0],this.height=a[1];else{if(!(w(a)&&w(a.width)&&w(a.height))){var o=new Error("Unsupported input. Must be either\n DOMNode, Array or Object with field width and height,\n or a function that returns any of the above.");throw o.value=s,o}this.width=a.width,this.height=a.height}}else{var h=n[0],u=n[1];this.width=h,this.height=u}}return T(t,[{key:"isEqual",value:function(e){if(e instanceof t)return this.width===e.width&&this.height===e.height;var n=new t(e);return this.width===n.width&&this.height===n.height}},{key:"toArray",value:function(){return[this.width,this.height]}},{key:"toObject",value:function(){return{width:this.width,height:this.height}}}]),t}(),it=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];A(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_BASIC:i,s=n.width,a=void 0===s?"100%":s,o=n.height,h=void 0===o?null:o,u=n.ratio,c=void 0===u?1:u,f=n.maxWidth,l=void 0===f?null:f,d=n.maxHeight,g=void 0===d?null:d;r===t.MODE_ASPECT_RATIO?(this.wFn=k(l),this.hFn=k(g),this.options={mode:r,ratio:c,maxWidth:l,maxHeight:g}):(this.wFn=k(a),this.hFn=k(h),this.options={mode:r,width:a,height:h})}return T(t,[{key:"fit",value:function(){var e=arguments.length<=0||void 0===arguments[0]?_("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?_("container"):arguments[1],i=new nt(e),r=i.width,s=i.height,a=new nt(n),o=a.width,h=a.height,u=void 0;if(this.options.mode===t.MODE_ASPECT_RATIO){var c=this.options.ratio,f=this.wFn(o,o),l=this.hFn(h,h),d=Math.floor(c*l);u=f>=d?new nt(d,l):new nt(f,Math.floor(f/c))}else u=new nt(this.wFn(r,o),this.hFn(s,h));return{dimension:u,changed:!u.isEqual(i)}}}]),t}();it.MODE_BASIC="basic",it.MODE_ASPECT_RATIO="aspectRatio";var rt=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];A(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_WINDOW:i,s=n.target,a=void 0===s?null:s,o=n.interval,h=void 0===o?500:o;r!==t.MODE_POLLING||a||_("options.target"),this.mode=r,this.target=a,this.interval=h,this.check=this.check.bind(this),this.throttledCheck=u(this.check,this.interval),this.isWatching=!1,this.listeners={change:[]}}return T(t,[{key:"hasTargetChanged",value:function(){if(!this.target)return!0;var t=new nt(this.target);return this.currentDim&&t.isEqual(this.currentDim)?!1:(this.currentDim=t,!0)}},{key:"check",value:function(){return this.hasTargetChanged()&&this.dispatch("change",this.currentDim),this}},{key:"dispatch",value:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;n>r;r++)i[r-1]=arguments[r];return this.listeners[t].forEach(function(t){return t.apply(e,i)}),this}},{key:"on",value:function(t,e){return-1===this.listeners[t].indexOf(e)&&this.listeners[t].push(e),this}},{key:"off",value:function(t,e){return this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),this}},{key:"start",value:function(){return this.isWatching||(this.target&&(this.currentDim=new nt(this.target)),this.mode===t.MODE_WINDOW?window.addEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&(this.intervalId=window.setInterval(this.check,this.interval)),this.isWatching=!0),this}},{key:"stop",value:function(){return this.isWatching&&(this.mode===t.MODE_WINDOW?window.removeEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.isWatching=!1),this}},{key:"destroy",value:function(){return this.stop(),this.listeners.change=[],this}}]),t}();rt.MODE_WINDOW="window",rt.MODE_POLLING="polling";var st=function(t){function e(){var t=arguments.length<=0||void 0===arguments[0]?_("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?_("container"):arguments[1],i=arguments[2],r=arguments[3];A(this,e);var s=W(this,Object.getPrototypeOf(e).call(this,r)),a=new it(i);return s.fit=function(){return a.fit(t,n)},s}return x(e,t),T(e,[{key:"check",value:function(){if(this.hasTargetChanged()){var t=this.fit(),e=t.changed,n=t.dimension;e&&this.dispatch("change",n)}return this}}]),e}(rt),at=function(){function t(n){A(this,t);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=g.apply(void 0,[{},t.DEFAULT_OPTIONS].concat(r));this._state={width:a.initialWidth,height:a.initialHeight,innerWidth:0,innerHeight:0,fitOptions:null,options:a,data:null},this.container=e.select(n),this.container.style("line-height",0);var o=this.constructor.getCustomEventNames();this.setupDispatcher(o),this._dispatchData=h(this._dispatchData.bind(this),1),this._dispatchOptions=h(this._dispatchOptions.bind(this),1),this._dispatchResize=h(this._dispatchResize.bind(this),1),this._updateDimension=h(this._updateDimension.bind(this),1)}return T(t,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(t,[{key:"setupDispatcher",value:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this._customEventNames=e,this._eventNames=t.DEFAULT_EVENTS.concat(e),this.dispatcher=n.dispatch.apply(this,this._eventNames)}},{key:"getCustomEventNames",value:function(){return this._customEventNames}},{key:"getInnerWidth",value:function(){return this._state.innerWidth}},{key:"getInnerHeight",value:function(){return this._state.innerHeight}},{key:"width",value:function(){if(0===arguments.length)return this._state.width;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.width&&(this._state.width=t,this._updateDimension(),this._dispatchResize()),this}},{key:"height",value:function(){if(0===arguments.length)return this._state.height;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.height&&(this._state.height=t,this._updateDimension(),this._dispatchResize()),this}},{key:"dimension",value:function(){if(0===arguments.length)return[this._state.width,this._state.height];var t=arguments.length<=0?void 0:arguments[0],e=N(t,2),n=e[0],i=e[1];return this.width(n).height(i),this}},{key:"data",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.data;var i=e[0];return this._state.data=i,this._dispatchData(),this}},{key:"margin",value:function(){if(0===arguments.length)return this._state.options.margin;var t=this._state.options.margin,e=v({},this._state.options.margin,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.margin=e,this._updateDimension(),this._dispatchResize()),this}},{key:"offset",value:function(){if(0===arguments.length)return this._state.options.offset;var t=this._state.options.offset,e=v({},this._state.offset,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.offset=e,this._updateDimension(),this._dispatchResize()),this}},{key:"options",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.options;var i=e[0];return i.margin&&this.margin(i.margin),i.offset&&this.offset(i.offset),this._state.options=g(this._state.options,i),this._dispatchOptions(),this}},{key:"_updateDimension",value:function(){var t=this._state,e=t.width,n=t.height,i=this._state.options.margin,r=i.top,s=i.right,a=i.bottom,o=i.left;return this._state.innerWidth=e-o-s,this._state.innerHeight=n-r-a,this}},{key:"updateDimensionNow",value:function(){return this._updateDimension(),this._updateDimension.flush(),this}},{key:"hasData",value:function(){var t=this._state.data;return null!==t&&void 0!==t}},{key:"hasNonZeroArea",value:function(){var t=this._state,e=t.innerWidth,n=t.innerHeight;return e>0&&n>0}},{key:"fit",value:function(t){var e=this,n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];t&&(this._state.fitOptions=t);var r=new it(t),s=r.fit(this.dimension(),this.container.node()),a=s.changed,o=s.dimension;a&&this.dimension([o.width,o.height]);var h=!!n;return h&&(this.fitWatcher&&this.fitWatcher.destroy(),this.fitWatcher=new st(this.dimension(),this.container.node(),this._state.fitOptions,i(n)?n:null).on("change",function(t){return e.dimension([t.width,t.height])}).start()),this}},{key:"stopFitWatcher",value:function(){return this.fitWatcher&&(this.fitWatcher.destroy(),this.fitWatcher=null),this}},{key:"_dispatchData",value:function(){return this.dispatcher.call("data",this,this._state.data),this}},{key:"_dispatchOptions",value:function(){return this.dispatcher.call("options",this,this._state.options),this}},{key:"_dispatchResize",value:function(){var t=this._state,e=t.width,n=t.height,i=t.innerWidth,r=t.innerHeight;return this.dispatcher.apply("resize",this,[e,n,i,r]),this}},{key:"on",value:function(t,e){return this.dispatcher.on(t,e),this}},{key:"off",value:function(t){return this.dispatcher.on(t,null),this}},{key:"destroy",value:function(){var t=this;this._eventNames.forEach(function(e){t.off(e)}),this.stopFitWatcher()}}]),t}();at.DEFAULT_OPTIONS={initialWidth:720,initialHeight:500,margin:{top:30,right:30,bottom:30,left:30},offset:{x:.5,y:.5}},at.DEFAULT_EVENTS=["data","options","resize"];var ot=function(t){function e(t){var n;A(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=W(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return a.canvas=a.container.append("canvas"),a.updateDimensionNow(),a}return x(e,t),T(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(e,[{key:"getContext2d",value:function(){var t=this.options(),e=t.pixelRatio,n=t.margin,i=t.offset,r=this.canvas.node().getContext("2d");return r.setTransform(1,0,0,1,0,0),r.scale(e,e),r.translate(n.left+i.x,n.top+i.y),r}},{key:"clear",value:function(){var t=this.options(),e=t.pixelRatio,n=this.canvas.node().getContext("2d");return n.setTransform(1,0,0,1,0,0),n.scale(e,e),n.clearRect(0,0,this.width(),this.height()),this}},{key:"_updateDimension",value:function(){j(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options.pixelRatio;return this.canvas.style("width",n).style("height",i).attr("width",n*r).attr("height",i*r),this}}]),e}(at);ot.DEFAULT_OPTIONS={pixelRatio:window.devicePixelRatio};var ht=function(t){function e(t){var n;A(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=W(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return a.svg=a.container.append("svg"),a.rootG=a.svg.append("g"),a.layers=new D(a.rootG),a.updateDimensionNow(),a}return x(e,t),T(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(e,[{key:"_updateDimension",value:function(){j(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options,s=r.offset,a=r.margin,o=a.top,h=a.left;return this.svg.attr("width",n).attr("height",i),this.rootG.attr("transform","translate("+(h+s.x)+","+(o+s.y)+")"),this}}]),e}(at);ht.DEFAULT_OPTIONS={},t.helper=et,t.AbstractChart=at,t.CanvasChart=ot,t.SvgChart=ht,t.LayerOrganizer=D,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch"],e):e(t.d3Kit=t.d3Kit||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function i(t){var e="undefined"==typeof t?"undefined":E(t);return null!=t&&("object"==e||"function"==e)}function r(t){var e=i(t)?S.call(t):"";return e==M||e==P||e==I}function s(t){return null!=t&&"object"==("undefined"==typeof t?"undefined":E(t))}function a(t){return"symbol"==("undefined"==typeof t?"undefined":E(t))||s(t)&&$.call(t)==H}function o(t){if("number"==typeof t)return t;if(a(t))return q;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(U,"");var n=K.test(t);return n||V.test(t)?Z(t.slice(2),n?2:8):B.test(t)?q:+t}function h(t,e,n){function r(e){var n=g,i=v;return g=v=void 0,_=e,m=t.apply(i,n)}function s(t){return _=t,y=setTimeout(u,e),b?r(t):m}function a(t){var n=t-w,i=t-_,r=e-n;return O?X(r,p-i):r}function h(t){var n=t-w,i=t-_;return void 0===w||n>=e||0>n||O&&i>=p}function u(){var t=z();return h(t)?c(t):void(y=setTimeout(u,a(t)))}function c(t){return y=void 0,k&&g?r(t):(g=v=void 0,m)}function f(){void 0!==y&&clearTimeout(y),_=0,g=w=v=y=void 0}function l(){return void 0===y?m:c(z())}function d(){var t=z(),n=h(t);if(g=arguments,v=this,w=t,n){if(void 0===y)return s(w);if(O)return y=setTimeout(u,e),r(w)}return void 0===y&&(y=setTimeout(u,e)),m}var g,v,p,m,y,w,_=0,b=!1,O=!1,k=!0;if("function"!=typeof t)throw new TypeError(J);return e=o(e)||0,i(n)&&(b=!!n.leading,O="maxWait"in n,p=O?Q(o(n.maxWait)||0,e):p,k="trailing"in n?!!n.trailing:k),d.cancel=f,d.flush=l,d}function u(t,e,n){var r=!0,s=!0;if("function"!=typeof t)throw new TypeError(Y);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),h(t,e,{leading:r,maxWait:e,trailing:s})}function c(t){return null==t?"":String(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(t){return null==t?"\\s":t.source?t.source:"["+c(t)+"]"}function l(t,e){if(null==t)return"";if(!e&&tt)return tt.call(t);var n=f(e),i=new RegExp("^"+n+"+|"+n+"+$","g");return String(t).replace(i,"")}function d(t){return l(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}function g(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var s in n)if(n.hasOwnProperty(s)){var a=n[s];t[s]=!i(a)||Array.isArray(a)||r(a)?a:g(t[s],a)}}return t}function v(t){t=t||{};for(var e=1;e<arguments.length;e++)if(arguments[e])for(var n in arguments[e])arguments[e].hasOwnProperty(n)&&(t[n]=arguments[e][n]);return t}function p(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function m(t,e){for(var n=1,i=arguments.length,r=void 0;++n<i;)t[r=arguments[n]]=p(t,e,e[r]);return t}function y(t){return r(t)?t:function(){return t}}function w(t){throw new Error("Missing parameter "+t)}function _(t){return null!==t&&void 0!==t}function b(t){return null===t||void 0===t}function O(t){return!(!t||1!==t.nodeType)}function k(t){if(b(t))return function(t,e){return Math.min(t,e)};var e=(""+t).trim().toLowerCase();if(e.indexOf("%")>-1){var n=function(){var t=+e.replace("%","")/100;return{v:function(e,n){return n*t}}}();if("object"===("undefined"==typeof n?"undefined":E(n)))return n.v}return function(){return+e.replace("px","")}}function D(t){function e(t,e){var n=arguments.length<=2||void 0===arguments[2]?"":arguments[2],i=e.split("."),r=void 0,s=void 0;i.length>1?(s=i[0].length>0?i[0]:h,r=i[1]):(s=h,r=i[0]);var a=""+n+r;if(u.hasOwnProperty(a))throw new Error("invalid or duplicate layer id: "+a);var o=d(r)+"-layer",c=t.append(s).classed(o,!0);return u[a]=c,c}function n(t,r){var s=arguments.length<=2||void 0===arguments[2]?"":arguments[2];if(Array.isArray(r))return r.map(function(e){return n(t,e,s)});if(i(r)){var a=Object.keys(r),o=C(a,1),h=o[0],u=e(t,h,s);return n(u,r[h],""+s+h+"/"),u}return e(t,r,s)}function r(e){return n(t,e)}function s(t){return Array.isArray(t)?t.map(r):r(t)}function a(t){return u[t]}function o(t){return!!u[t]}var h=arguments.length<=1||void 0===arguments[1]?"g":arguments[1],u={};return{create:s,get:a,has:o}}var E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},j=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},x=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),W=function ut(t,e,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,e);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:ut(r,e,n)}if("value"in i)return i.value;var s=i.get;return void 0===s?void 0:s.call(n)},A=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},T=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},C=function(){function t(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var a,o=t[Symbol.iterator]();!(i=(a=o.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(h){r=!0,s=h}finally{try{!i&&o["return"]&&o["return"]()}finally{if(r)throw s}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),M="[object Function]",P="[object GeneratorFunction]",I="[object Proxy]",N=Object.prototype,S=N.toString,R="object"==("undefined"==typeof global?"undefined":E(global))&&global&&global.Object===Object&&global,F="object"==("undefined"==typeof self?"undefined":E(self))&&self&&self.Object===Object&&self,L=R||F||Function("return this")(),z=function(){return L.Date.now()},H="[object Symbol]",G=Object.prototype,$=G.toString,q=0/0,U=/^\s+|\s+$/g,B=/^[-+]0x[0-9a-f]+$/i,K=/^0b[01]+$/i,V=/^0o[0-7]+$/i,Z=parseInt,J="Expected a function",Q=Math.max,X=Math.min,Y="Expected a function",tt=String.prototype.trim,et=Object.freeze({isObject:i,isFunction:r,kebabCase:d,deepExtend:g,extend:v,rebind:m,functor:y,debounce:h,throttle:u}),nt=function(){function t(){j(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];if(1===n.length){var s=n[0],a=r(s)?s():s;if(a instanceof t)this.width=a.width,this.height=a.height;else if(O(a))this.width=a.clientWidth,this.height=a.clientHeight;else if(Array.isArray(a))this.width=a[0],this.height=a[1];else{if(!(_(a)&&_(a.width)&&_(a.height))){var o=new Error("Unsupported input. Must be either\n DOMNode, Array or Object with field width and height,\n or a function that returns any of the above.");throw o.value=s,o}this.width=a.width,this.height=a.height}}else{var h=n[0],u=n[1];this.width=h,this.height=u}}return x(t,[{key:"isEqual",value:function(e){if(e instanceof t)return this.width===e.width&&this.height===e.height;var n=new t(e);return this.width===n.width&&this.height===n.height}},{key:"toArray",value:function(){return[this.width,this.height]}},{key:"toObject",value:function(){return{width:this.width,height:this.height}}}]),t}(),it=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];j(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_BASIC:i,s=n.width,a=void 0===s?"100%":s,o=n.height,h=void 0===o?null:o,u=n.ratio,c=void 0===u?1:u,f=n.maxWidth,l=void 0===f?null:f,d=n.maxHeight,g=void 0===d?null:d;r===t.MODE_ASPECT_RATIO?(this.wFn=k(l),this.hFn=k(g),this.options={mode:r,ratio:c,maxWidth:l,maxHeight:g}):(this.wFn=k(a),this.hFn=k(h),this.options={mode:r,width:a,height:h})}return x(t,[{key:"fit",value:function(){var e=arguments.length<=0||void 0===arguments[0]?w("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?w("container"):arguments[1],i=new nt(e),r=i.width,s=i.height,a=new nt(n),o=a.width,h=a.height,u=void 0;if(this.options.mode===t.MODE_ASPECT_RATIO){var c=this.options.ratio,f=this.wFn(o,o),l=this.hFn(h,h),d=Math.floor(c*l);u=f>=d?new nt(d,l):new nt(f,Math.floor(f/c))}else u=new nt(this.wFn(r,o),this.hFn(s,h));return{dimension:u,changed:!u.isEqual(i)}}}]),t}();it.MODE_BASIC="basic",it.MODE_ASPECT_RATIO="aspectRatio";var rt=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];j(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_WINDOW:i,s=n.target,a=void 0===s?null:s,o=n.interval,h=void 0===o?500:o;r!==t.MODE_POLLING||a||w("options.target"),this.mode=r,this.target=a,this.interval=h,this.check=this.check.bind(this),this.throttledCheck=u(this.check,this.interval),this.isWatching=!1,this.listeners={change:[]}}return x(t,[{key:"hasTargetChanged",value:function(){if(!this.target)return!0;var t=new nt(this.target);return this.currentDim&&t.isEqual(this.currentDim)?!1:(this.currentDim=t,!0)}},{key:"check",value:function(){return this.hasTargetChanged()&&this.dispatch("change",this.currentDim),this}},{key:"dispatch",value:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;n>r;r++)i[r-1]=arguments[r];return this.listeners[t].forEach(function(t){return t.apply(e,i)}),this}},{key:"on",value:function(t,e){return-1===this.listeners[t].indexOf(e)&&this.listeners[t].push(e),this}},{key:"off",value:function(t,e){return this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),this}},{key:"start",value:function(){return this.isWatching||(this.target&&(this.currentDim=new nt(this.target)),this.mode===t.MODE_WINDOW?window.addEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&(this.intervalId=window.setInterval(this.check,this.interval)),this.isWatching=!0),this}},{key:"stop",value:function(){return this.isWatching&&(this.mode===t.MODE_WINDOW?window.removeEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.isWatching=!1),this}},{key:"destroy",value:function(){return this.stop(),this.listeners.change=[],this}}]),t}();rt.MODE_WINDOW="window",rt.MODE_POLLING="polling";var st=function(t){function e(){var t=arguments.length<=0||void 0===arguments[0]?w("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?w("container"):arguments[1],i=arguments[2],r=arguments[3];j(this,e);var s=T(this,Object.getPrototypeOf(e).call(this,r)),a=new it(i);return s.fit=function(){return a.fit(t,n)},s}return A(e,t),x(e,[{key:"check",value:function(){if(this.hasTargetChanged()){var t=this.fit(),e=t.changed,n=t.dimension;e&&this.dispatch("change",n)}return this}}]),e}(rt),at=function(){function t(n){j(this,t);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=g.apply(void 0,[this.constructor.getDefaultOptions()].concat(r));this._state={width:a.initialWidth,height:a.initialHeight,innerWidth:0,innerHeight:0,fitOptions:null,options:a,data:null},this.container=e.select(n),this.container.style("line-height",0);var o=this.constructor.getCustomEventNames();this.setupDispatcher(o),this._dispatchData=h(this._dispatchData.bind(this),1),this._dispatchOptions=h(this._dispatchOptions.bind(this),1),this._dispatchResize=h(this._dispatchResize.bind(this),1),this._updateDimension=h(this._updateDimension.bind(this),1)}return x(t,null,[{key:"getDefaultOptions",value:function(){return{initialWidth:720,initialHeight:500,margin:{top:30,right:30,bottom:30,left:30},offset:{x:.5,y:.5}}}},{key:"getCustomEventNames",value:function(){return[]}}]),x(t,[{key:"setupDispatcher",value:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this._customEventNames=e,this._eventNames=t.DEFAULT_EVENTS.concat(e),this.dispatcher=n.dispatch.apply(this,this._eventNames)}},{key:"getCustomEventNames",value:function(){return this._customEventNames}},{key:"getInnerWidth",value:function(){return this._state.innerWidth}},{key:"getInnerHeight",value:function(){return this._state.innerHeight}},{key:"width",value:function(){if(0===arguments.length)return this._state.width;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.width&&(this._state.width=t,this._updateDimension(),this._dispatchResize()),this}},{key:"height",value:function(){if(0===arguments.length)return this._state.height;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.height&&(this._state.height=t,this._updateDimension(),this._dispatchResize()),this}},{key:"dimension",value:function(){if(0===arguments.length)return[this._state.width,this._state.height];var t=arguments.length<=0?void 0:arguments[0],e=C(t,2),n=e[0],i=e[1];return this.width(n).height(i),this}},{key:"data",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.data;var i=e[0];return this._state.data=i,this._dispatchData(),this}},{key:"margin",value:function(){if(0===arguments.length)return this._state.options.margin;var t=this._state.options.margin,e=v({},this._state.options.margin,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.margin=e,this._updateDimension(),this._dispatchResize()),this}},{key:"offset",value:function(){if(0===arguments.length)return this._state.options.offset;var t=this._state.options.offset,e=v({},this._state.offset,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.offset=e,this._updateDimension(),this._dispatchResize()),this}},{key:"options",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.options;var i=e[0];return i.margin&&this.margin(i.margin),i.offset&&this.offset(i.offset),this._state.options=g(this._state.options,i),this._dispatchOptions(),this}},{key:"_updateDimension",value:function(){var t=this._state,e=t.width,n=t.height,i=this._state.options.margin,r=i.top,s=i.right,a=i.bottom,o=i.left;return this._state.innerWidth=e-o-s,this._state.innerHeight=n-r-a,this}},{key:"updateDimensionNow",value:function(){return this._updateDimension(),this._updateDimension.flush(),this}},{key:"hasData",value:function(){var t=this._state.data;return null!==t&&void 0!==t}},{key:"hasNonZeroArea",value:function(){var t=this._state,e=t.innerWidth,n=t.innerHeight;return e>0&&n>0}},{key:"fit",value:function(t){var e=this,n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];t&&(this._state.fitOptions=t);var r=new it(t),s=r.fit(this.dimension(),this.container.node()),a=s.changed,o=s.dimension;a&&this.dimension([o.width,o.height]);var h=!!n;return h&&(this.fitWatcher&&this.fitWatcher.destroy(),this.fitWatcher=new st(this.dimension(),this.container.node(),this._state.fitOptions,i(n)?n:null).on("change",function(t){return e.dimension([t.width,t.height])}).start()),this}},{key:"stopFitWatcher",value:function(){return this.fitWatcher&&(this.fitWatcher.destroy(),this.fitWatcher=null),this}},{key:"_dispatchData",value:function(){return this.dispatcher.call("data",this,this._state.data),this}},{key:"_dispatchOptions",value:function(){return this.dispatcher.call("options",this,this._state.options),this}},{key:"_dispatchResize",value:function(){var t=this._state,e=t.width,n=t.height,i=t.innerWidth,r=t.innerHeight;return this.dispatcher.apply("resize",this,[e,n,i,r]),this}},{key:"on",value:function(t,e){return this.dispatcher.on(t,e),this}},{key:"off",value:function(t){return this.dispatcher.on(t,null),this}},{key:"destroy",value:function(){var t=this;this._eventNames.forEach(function(e){t.off(e)}),this.stopFitWatcher()}}]),t}();at.DEFAULT_EVENTS=["data","options","resize"];var ot=function(t){function e(t){var n;j(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=T(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t].concat(r)));return a.canvas=a.container.append("canvas"),a.updateDimensionNow(),a}return A(e,t),x(e,null,[{key:"getDefaultOptions",value:function(){return g(W(Object.getPrototypeOf(e),"getDefaultOptions",this).call(this),{pixelRatio:window.devicePixelRatio})}}]),x(e,[{key:"getContext2d",value:function(){var t=this.options(),e=t.pixelRatio,n=t.margin,i=t.offset,r=this.canvas.node().getContext("2d");return r.setTransform(1,0,0,1,0,0),r.scale(e,e),r.translate(n.left+i.x,n.top+i.y),r}},{key:"clear",value:function(){var t=this.options(),e=t.pixelRatio,n=this.canvas.node().getContext("2d");return n.setTransform(1,0,0,1,0,0),n.scale(e,e),n.clearRect(0,0,this.width(),this.height()),this}},{key:"_updateDimension",value:function(){W(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options.pixelRatio;return this.canvas.style("width",n).style("height",i).attr("width",n*r).attr("height",i*r),this}}]),e}(at),ht=function(t){function e(t){var n;j(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=T(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t].concat(r)));return a.svg=a.container.append("svg"),a.rootG=a.svg.append("g"),a.layers=new D(a.rootG),a.updateDimensionNow(),a}return A(e,t),x(e,[{key:"_updateDimension",value:function(){W(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options,s=r.offset,a=r.margin,o=a.top,h=a.left;return this.svg.attr("width",n).attr("height",i),this.rootG.attr("transform","translate("+(h+s.x)+","+(o+s.y)+")"),this}}]),e}(at);t.helper=et,t.AbstractChart=at,t.CanvasChart=ot,t.SvgChart=ht,t.LayerOrganizer=D,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3kit",
"version": "3.0.0",
"version": "3.1.0",
"description": "A kit of tools to speed D3 related project development.",

@@ -5,0 +5,0 @@ "repository": {

@@ -147,10 +147,15 @@ # d3Kit

// Define default options for this chart
const DEFAULT_OPTIONS = {
margin: {top: 60, right: 60, bottom: 60, left: 60},
initialWidth: 800,
initialHeight: 460
};
class SvgBubbleChart extends SvgChart {
// Define default options for this chart
static getDefaultOptions() {
return deepExtend(
super.getDefaultOptions(),
{
margin: {top: 60, right: 60, bottom: 60, left: 60},
initialWidth: 800,
initialHeight: 460
}
);
}
class SvgBubbleChart extends SvgChart {
/**

@@ -165,3 +170,3 @@ * Define the names of custom events that can be dispatched from this chart

constructor(selector, options) {
super(selector, DEFAULT_OPTIONS, options);
super(selector, options);

@@ -220,4 +225,2 @@ // Add custom variables

SvgBubbleChart.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
export default SvgBubbleChart;

@@ -288,10 +291,15 @@ ```

// Define default options for this chart
const DEFAULT_OPTIONS = {
margin: {top: 60, right: 60, bottom: 60, left: 60},
initialWidth: 800,
initialHeight: 460
};
class CanvasBubbleChart extends CanvasChart {
// Define default options for this chart
static getDefaultOptions() {
return deepExtend(
super.getDefaultOptions(),
{
margin: {top: 60, right: 60, bottom: 60, left: 60},
initialWidth: 800,
initialHeight: 460
}
);
}
class CanvasBubbleChart extends CanvasChart {
/**

@@ -306,3 +314,3 @@ * Define the names of custom events that can be dispatched from this chart

constructor(selector, options) {
super(selector, DEFAULT_OPTIONS, options);
super(selector, options);

@@ -349,4 +357,2 @@ // add custom variables

CanvasBubbleChart.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
export default CanvasBubbleChart;

@@ -353,0 +359,0 @@ ```

@@ -8,2 +8,19 @@ import { select } from 'd3-selection';

class AbstractChart {
static getDefaultOptions() {
return {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30,
},
offset: {
x: 0.5,
y: 0.5,
},
};
}
static getCustomEventNames() {

@@ -15,4 +32,3 @@ return [];

const mergedOptions = deepExtend(
{},
AbstractChart.DEFAULT_OPTIONS,
this.constructor.getDefaultOptions(),
...options

@@ -248,19 +264,4 @@ );

AbstractChart.DEFAULT_OPTIONS = {
initialWidth: 720,
initialHeight: 500,
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30,
},
offset: {
x: 0.5,
y: 0.5,
},
};
AbstractChart.DEFAULT_EVENTS = ['data', 'options', 'resize'];
export default AbstractChart;
import AbstractChart from './AbstractChart.js';
import { deepExtend } from './helper.js';
class CanvasChart extends AbstractChart {
static getCustomEventNames() {
return [];
static getDefaultOptions() {
return deepExtend(
super.getDefaultOptions(),
{
pixelRatio: window.devicePixelRatio,
}
);
}
constructor(selector, ...options) {
super(selector, CanvasChart.DEFAULT_OPTIONS, ...options);
super(selector, ...options);

@@ -52,6 +58,2 @@ this.canvas = this.container.append('canvas');

CanvasChart.DEFAULT_OPTIONS = {
pixelRatio: window.devicePixelRatio,
};
export default CanvasChart;

@@ -5,8 +5,4 @@ import AbstractChart from './AbstractChart.js';

class SvgChart extends AbstractChart {
static getCustomEventNames() {
return [];
}
constructor(selector, ...options) {
super(selector, SvgChart.DEFAULT_OPTIONS, ...options);
super(selector, ...options);

@@ -39,4 +35,2 @@ this.svg = this.container.append('svg');

SvgChart.DEFAULT_OPTIONS = {};
export default SvgChart;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc