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 1.1.0 to 2.0.0-rc1

src/chartlet.js

13

CHANGELOG.md
# Change logs
## v2.x.x
### 2.0.0 (2016-08-16)
Make d3Kit compatible with D3 v4. Key changes are due to:
- Removal of `d3.functor` and `d3.rebind`. Implement helper functions as replacements.
- API changes for `d3.dispatch`. Now use `dispatch.call('x', ...)` instead of `dispatch.x(...)`
The npm package also remove `d3` from `dependencies` and add `d3-selection` and `d3-dispatch` to `peerDependencies` instead.
In terms of development, switch from grunt to gulp and webpack and prepare to migrate each module to es2015.
## v1.x.x

@@ -4,0 +17,0 @@

1933

dist/d3kit.js

@@ -1,863 +0,1082 @@

// Define module using Universal Module Definition pattern
// https://github.com/umdjs/umd/blob/master/amdWeb.js
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("d3-selection"), require("d3-dispatch"));
else if(typeof define === 'function' && define.amd)
define(["d3-selection", "d3-dispatch"], factory);
else if(typeof exports === 'object')
exports["d3Kit"] = factory(require("d3-selection"), require("d3-dispatch"));
else
root["d3Kit"] = factory(root["d3"], root["d3"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// Support AMD. Register as an anonymous module.
// EDIT: List all dependencies in AMD style
define(['d3'], factory);
} else if (typeof exports === 'object') {
// Support CommonJS
// EDIT: List all dependencies in CommonJS style
module.exports = factory(require('d3'));
} else {
// No AMD. Set module as a global variable
// EDIT: Pass dependencies to factory function
root.d3Kit = factory(root.d3);
}
}(this,
//EDIT: The dependencies are passed to this function
function (d3) {
//---------------------------------------------------
// BEGIN code for this module
//---------------------------------------------------
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
var modules_helper;
modules_helper = function () {
//---------------------------------------------------
// BEGIN code for this module
//---------------------------------------------------
var module = function () {
/**
* Example usage:
* selection.call(d3Kit.helper.bindMouseEventsToDispatcher, dispatch, 'bar')
*
* @param {[type]} dispatch [description]
* @param {[type]} prefix [description]
* @return {[type]} [description]
*/
function bindMouseEventsToDispatcher(selection, dispatch, prefix) {
return selection.on('click', dispatch[prefix + 'Click']).on('mouseover', dispatch[prefix + 'MouseOver']).on('mousemove', dispatch[prefix + 'MouseMove']).on('mouseout', dispatch[prefix + 'MouseOut']);
}
function removeAllChildren(selection, noTransition) {
if (noTransition) {
return selection.selectAll('*').remove();
} else {
return selection.selectAll('*').transition().style('opacity', 0).remove();
}
}
// Returns true if it is a DOM element
// From http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
function isElement(o) {
return typeof HTMLElement === 'object' ? o instanceof HTMLElement : //DOM2
o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
}
var isNaN = Number.isNaN ? Number.isNaN : window.isNaN;
// Check whether s is element if not then do the querySelector
function $(s) {
return isElement(s) ? s : document.querySelector(s);
}
// To get a proper array from a NodeList that matches the CSS selector
function $$(s) {
return Array.isArray(s) ? s : [].slice.call(document.querySelectorAll(s));
}
//---------------------------------------------------
// From http://youmightnotneedjquery.com/
//---------------------------------------------------
function deepExtend(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
var obj = arguments[i];
if (!obj)
continue;
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var value = obj[key];
if (isObject(value) && !Array.isArray(value) && !isFunction(value)) {
out[key] = deepExtend(out[key], value);
} else
out[key] = value;
}
}
}
return out;
}
function extend(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
if (!arguments[i])
continue;
for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key))
out[key] = arguments[i][key];
}
}
return out;
}
function on(element, type, listener) {
if (element.addEventListener) {
element.addEventListener(type, listener, false);
} else if (element.attachEvent) {
element.attachEvent('on' + type, listener);
}
}
function off(element, type, listener) {
element.removeEventListener(type, listener, false);
}
//---------------------------------------------------
// Modified from lodash
//---------------------------------------------------
/**
* Returns a function, that, as long as it continues to be invoked,
* will not be triggered.
* The function will be called after it stops being called for
* "wait" milliseconds.
* The output function can be called with .now() to execute immediately
* For example:
* doSomething(params); // will debounce
* doSomething.now(params); // will execute immediately
*
* @param Function func function to be debounced
* @param Number wait wait time until it will be executed
* @param Boolean immediate If "immediate" is passed, trigger the function on the
* leading edge, instead of the trailing.
* @return Function debounced function
*/
function debounce(func, wait, immediate) {
var timeout;
var outputFn = function () {
var context = this, args = arguments;
var later = function () {
timeout = null;
if (!immediate)
func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow)
func.apply(context, args);
// return caller for chaining
return context;
};
// so we know this function is debounced
outputFn.isDebounced = true;
// and provide a way to call the original function immediately
outputFn.now = function () {
clearTimeout(timeout);
return func.apply(this, arguments);
};
return outputFn;
}
//---------------------------------------------------
// From lodash
//---------------------------------------------------
/** Used to determine if values are of the language type Object */
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// http://code.google.com/p/v8/issues/detail?id=2291
return !!(value && objectTypes[typeof value]);
}
/** `Object#toString` result shortcuts */
var numberClass = '[object Number]';
/** Used for native method references */
var objectProto = Object.prototype;
/** Used to resolve the internal [[Class]] of values */
var toString = objectProto.toString;
/**
* Checks if `value` is a number.
*
* Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
*
* @static
* @memberOf _
* @category Objects
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if the `value` is a number, else `false`.
* @example
*
* _.isNumber(8.4 * 5);
* // => true
*/
function isNumber(value) {
return typeof value == 'number' || value && typeof value == 'object' && toString.call(value) == numberClass || false;
}
function isFunction(functionToCheck) {
var getType = {};
return !!functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}
//---------------------------------------------------
// From underscore.string
//---------------------------------------------------
/* jshint ignore:start */
var nativeTrim = String.prototype.trim;
function escapeRegExp(str) {
if (str == null)
return '';
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}
var defaultToWhiteSpace = function (characters) {
if (characters == null)
return '\\s';
else if (characters.source)
return characters.source;
else
return '[' + escapeRegExp(characters) + ']';
};
function trim(str, characters) {
if (str == null)
return '';
if (!characters && nativeTrim)
return nativeTrim.call(str);
characters = defaultToWhiteSpace(characters);
return String(str).replace(new RegExp('^' + characters + '+|' + characters + '+$', 'g'), '');
}
function dasherize(str) {
return trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
}
/* jshint ignore:end */
return {
$: $,
$$: $$,
dasherize: dasherize,
debounce: debounce,
deepExtend: deepExtend,
extend: extend,
isElement: isElement,
isFunction: isFunction,
isNaN: isNaN,
isNumber: isNumber,
isObject: isObject,
on: on,
off: off,
trim: trim,
removeAllChildren: removeAllChildren,
bindMouseEventsToDispatcher: bindMouseEventsToDispatcher
};
}();
// return module
return module; //---------------------------------------------------
// END code for this module
//---------------------------------------------------
}();
var modules_layerOrganizer;
modules_layerOrganizer = function (helper) {
//---------------------------------------------------
// BEGIN code for this module
//---------------------------------------------------
//
// EXAMPLE USAGE:
//
// var layers = new d3LayerOrganizer(vis);
// layers.create([
// {'axis': ['bar', 'mark']},
// 'glass',
// 'label'
// ]);
//
// Then access the layers via
// layers.get('axis'),
// layers.get('axis.bar'),
// layers.get('axis.mark'),
// layers.get('glass'),
// layers.get('label')
//
return function (mainContainer, tag) {
var layers = {};
tag = tag || 'g';
function createLayerFromName(container, layerName, prefix) {
var id = prefix ? prefix + '.' + layerName : layerName;
if (layers.hasOwnProperty(id)) {
throw 'invalid or duplicate layer id: ' + id;
}
var layer = container.append(tag).classed(helper.dasherize(layerName) + '-layer', true);
layers[id] = layer;
return layer;
}
function createLayerFromInfo(container, layerInfo, prefix) {
if (Array.isArray(layerInfo)) {
return layerInfo.map(function (info) {
createLayerFromInfo(container, info, prefix);
});
} else if (helper.isObject(layerInfo)) {
var parentKey = Object.keys(layerInfo)[0];
var parentLayer = createLayerFromName(container, parentKey, prefix);
createLayerFromInfo(parentLayer, layerInfo[parentKey], prefix ? prefix + '.' + parentKey : parentKey);
return parentLayer;
} else {
return createLayerFromName(container, layerInfo, prefix);
}
}
function createLayer(layerInfo) {
return createLayerFromInfo(mainContainer, layerInfo);
}
function create(layerNames) {
if (Array.isArray(layerNames)) {
return layerNames.map(createLayer);
} else {
return createLayer(layerNames);
}
}
function get(layerName) {
return layers[layerName];
}
function has(layerName) {
return !!layers[layerName];
}
return {
create: create,
get: get,
has: has
};
}; //---------------------------------------------------
// END code for this module
//---------------------------------------------------
}(modules_helper);
var modules_skeleton;
modules_skeleton = function (d3, LayerOrganizer, helper) {
//---------------------------------------------------
// BEGIN code for this module
//---------------------------------------------------
// Constants
var DEFAULT_OPTIONS = {
margin: {
top: 30,
right: 30,
bottom: 30,
left: 30
},
offset: [
0.5,
0.5
],
initialWidth: 720,
initialHeight: 500
};
var BASE_EVENTS = [
'data',
'options',
'resize'
];
// Core Skeleton
function Skeleton(chartNode, customOptions, customEvents) {
var skeleton = {};
chartNode = helper.$(chartNode);
var _data = null;
var _options = helper.deepExtend({}, DEFAULT_OPTIONS, customOptions);
var _totalWidth = 0;
var _totalHeight = 0;
var _innerWidth = 0;
var _innerHeight = 0;
var _autoResizeDetection = 'window';
// either 'window' or 'dom';
var _autoResizeMode = false;
var _autoResizeFn = null;
var _autoResizeToAspectRatio = false;
// add svg element
var _svg = d3.select(chartNode).append('svg');
var _vis = _svg.append('g');
updateOffset();
var _layers = new LayerOrganizer(_vis);
// setup event dispatcher
var _customEvents = customEvents ? customEvents.concat(BASE_EVENTS) : BASE_EVENTS;
var _dispatch = d3.dispatch.apply(d3, _customEvents);
// set default dimension
dimension([
_options.initialWidth,
_options.initialHeight
]);
function data(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _data;
}
// setter
_data = newValue;
// dispatch
if (!doNotDispatch) {
_dispatch.data(newValue);
}
return skeleton;
}
function options(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _options;
}
// setter
_options = helper.deepExtend(_options, newValue);
if (newValue) {
if (newValue.margin) {
updateMargin(doNotDispatch);
} else if (newValue.offset) {
// When the margin is changed,
// updateOffset() is already called within updateMargin()
// so "else if" is used here instead of "if".
// This will call updateOffset() manually
// only when margin is not changed and offset is changed.
updateOffset();
}
}
// dispatch
if (!doNotDispatch) {
_dispatch.options(newValue);
}
return skeleton;
}
function updateOffset() {
_vis.attr('transform', 'translate(' + (_options.margin.left + _options.offset[0]) + ',' + (_options.margin.top + _options.offset[1]) + ')');
}
function updateMargin(doNotDispatch) {
updateOffset();
_innerWidth = _totalWidth - _options.margin.left - _options.margin.right;
_innerHeight = _totalHeight - _options.margin.top - _options.margin.bottom;
if (!doNotDispatch) {
_dispatch.resize([
_totalWidth,
_totalHeight,
_innerWidth,
_innerHeight
]);
}
}
function margin(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _options.margin;
}
// setter
_options.margin = helper.extend(_options.margin, newValue);
updateMargin(doNotDispatch);
return skeleton;
}
function offset(newValue) {
// getter
if (arguments.length === 0) {
return _options.offset;
}
// setter
_options.offset = newValue;
updateOffset();
return skeleton;
}
function width(newValue, doNotDispatch) {
// getter
if (arguments.length === 0 || newValue === null || newValue === undefined) {
return _totalWidth;
}
// setter
if (helper.isNumber(newValue)) {
_totalWidth = +newValue;
} else if (newValue.trim().toLowerCase() == 'auto') {
_totalWidth = chartNode.clientWidth;
} else {
_totalWidth = +(newValue + '').replace(/px/gi, '').trim();
}
if (helper.isNaN(_totalWidth)) {
throw Error('invalid width: ' + _totalWidth);
}
// round to integer
_totalWidth = Math.floor(_totalWidth);
_innerWidth = _totalWidth - _options.margin.left - _options.margin.right;
_svg.attr('width', _totalWidth);
// dispatch
if (!doNotDispatch) {
_dispatch.resize([
_totalWidth,
_totalHeight,
_innerWidth,
_innerHeight
]);
}
return skeleton;
}
function height(newValue, doNotDispatch) {
// getter
if (arguments.length === 0 || newValue === null || newValue === undefined) {
return _totalHeight;
}
// setter
if (helper.isNumber(newValue)) {
_totalHeight = +newValue;
} else if (newValue.trim().toLowerCase() == 'auto') {
_totalHeight = chartNode.clientHeight;
} else {
_totalHeight = +(newValue + '').replace(/px/gi, '').trim();
}
if (helper.isNaN(_totalHeight)) {
throw Error('invalid height: ' + _totalHeight);
}
// round to integer
_totalHeight = Math.floor(_totalHeight);
_innerHeight = _totalHeight - _options.margin.top - _options.margin.bottom;
_svg.attr('height', _totalHeight);
// dispatch
if (!doNotDispatch) {
_dispatch.resize([
_totalWidth,
_totalHeight,
_innerWidth,
_innerHeight
]);
}
return skeleton;
}
function dimension(values, doNotDispatch) {
if (arguments.length === 0) {
return [
_totalWidth,
_totalHeight
];
}
width(values[0], true);
height(values[1], doNotDispatch);
return skeleton;
}
function autoResize(newMode) {
if (arguments.length === 0) {
return _autoResizeMode;
} else if (_autoResizeMode != newMode) {
return setupAutoResize(newMode, _autoResizeDetection);
}
return skeleton;
}
function autoResizeDetection(newDetection) {
if (arguments.length === 0) {
return _autoResizeDetection;
} else if (_autoResizeDetection != newDetection) {
return setupAutoResize(_autoResizeMode, newDetection);
}
return skeleton;
}
function autoResizeToAspectRatio(ratio) {
if (arguments.length === 0) {
return _autoResizeToAspectRatio;
}
if (ratio === null || ratio === undefined || ratio === '' || ratio === false || (ratio + '').toLowerCase() === 'false') {
_autoResizeToAspectRatio = false;
} else if (!helper.isNumber(ratio)) {
_autoResizeToAspectRatio = false;
} else if (+ratio === 0) {
_autoResizeToAspectRatio = false;
} else {
_autoResizeToAspectRatio = +ratio;
}
return skeleton;
}
function clearAutoResizeListener() {
if (_autoResizeFn) {
switch (_autoResizeDetection) {
case 'dom':
helper.off(chartNode, 'resize', _autoResizeFn);
break;
default:
case 'window':
helper.off(window, 'resize', _autoResizeFn);
break;
}
}
_autoResizeFn = null;
return skeleton;
}
function setAutoResizeListener(fn) {
if (fn) {
switch (_autoResizeDetection) {
case 'dom':
helper.on(chartNode, 'resize', fn);
break;
default:
case 'window':
helper.on(window, 'resize', fn);
break;
}
}
_autoResizeFn = fn;
return skeleton;
}
function setupAutoResize(newMode, newDetection) {
newMode = newMode && (newMode + '').toLowerCase() == 'false' ? false : newMode;
newDetection = newDetection || _autoResizeDetection;
// check if there is change in listener
if (newMode != _autoResizeMode) {
clearAutoResizeListener();
_autoResizeMode = newMode;
_autoResizeDetection = newDetection;
if (newMode) {
_autoResizeFn = helper.debounce(function () {
if (_autoResizeToAspectRatio) {
resizeToFitContainer(_autoResizeMode, true);
resizeToAspectRatio(_autoResizeToAspectRatio);
} else {
resizeToFitContainer(_autoResizeMode);
}
}, 100);
setAutoResizeListener(_autoResizeFn);
}
} // change detection mode only
else if (newDetection != _autoResizeDetection) {
var oldAutoResizeFn = _autoResizeFn;
clearAutoResizeListener();
_autoResizeDetection = newDetection;
setAutoResizeListener(oldAutoResizeFn);
}
if (_autoResizeFn)
_autoResizeFn();
return skeleton;
}
function getCustomEventNames() {
return Object.keys(_dispatch).filter(function (d) {
return BASE_EVENTS.indexOf(d) < 0;
});
}
function mixin(mixer) {
var self = skeleton;
if (helper.isObject(mixer)) {
Object.keys(mixer).forEach(function (key) {
self[key] = mixer[key];
});
}
return self;
}
// This function is only syntactic sugar
function resizeToFitContainer(mode, doNotDispatch) {
switch (mode) {
case 'all':
case 'full':
case 'both':
dimension([
'auto',
'auto'
], doNotDispatch);
break;
case 'height':
height('auto', doNotDispatch);
break;
default:
case 'width':
width('auto', doNotDispatch);
break;
}
return skeleton;
}
function resizeToAspectRatio(ratio, doNotDispatch) {
var w = _totalWidth;
var h = _totalHeight;
if (!helper.isNumber(ratio))
throw 'Invalid ratio: must be a Number';
ratio = +ratio;
// no need to resize if already at ratio
if ((w / h).toFixed(4) == ratio.toFixed(4))
return skeleton;
var estimatedH = Math.floor(w / ratio);
if (estimatedH > h) {
width(Math.floor(h * ratio), doNotDispatch);
} else {
height(estimatedH, doNotDispatch);
}
return skeleton;
}
function hasData() {
return _data !== null && _data !== undefined;
}
function hasNonZeroArea() {
return _innerWidth > 0 && _innerHeight > 0;
}
// define public fields and functions
helper.extend(skeleton, {
// getter only
getCustomEventNames: getCustomEventNames,
getDispatcher: function () {
return _dispatch;
},
getInnerWidth: function () {
return _innerWidth;
},
getInnerHeight: function () {
return _innerHeight;
},
getLayerOrganizer: function () {
return _layers;
},
getRootG: function () {
return _vis;
},
getSvg: function () {
return _svg;
},
// getter & setter
data: data,
options: options,
margin: margin,
offset: offset,
width: width,
height: height,
dimension: dimension,
autoResize: autoResize,
autoResizeDetection: autoResizeDetection,
autoResizeToAspectRatio: autoResizeToAspectRatio,
// functions
hasData: hasData,
hasNonZeroArea: hasNonZeroArea,
mixin: mixin,
resizeToFitContainer: resizeToFitContainer,
resizeToAspectRatio: resizeToAspectRatio
});
// bind events
d3.rebind(skeleton, _dispatch, 'on');
return skeleton;
}
// return module
return Skeleton; //---------------------------------------------------
// END code for this module
//---------------------------------------------------
}(d3, modules_layerOrganizer, modules_helper);
var modules_factory;
modules_factory = function (Skeleton, helper) {
//---------------------------------------------------
// BEGIN code for this module
//---------------------------------------------------
var module = function () {
/**
* Return a constructor for your custom chart type
* @param Object defaultOptions default options for your chart
* @param Array[String] customEvents list of custom events this chart will dispatch
* @param Function constructor constructor function function(skeleton){...}
* @return Function function(chartNode, options) that return your chart
*/
function createChart(defaultOptions, customEvents, constructor) {
var newChartClass = function (chartNode, options) {
var skeleton = new Skeleton(chartNode, helper.deepExtend({}, defaultOptions, options), customEvents);
if (constructor)
constructor(skeleton);
return skeleton;
};
customEvents = customEvents ? customEvents : [];
/**
* Return supported custom events for this chart class.
* This is a static method for class, not instance method.
* @return Array[String] names of custom events
*/
newChartClass.getCustomEvents = function () {
return customEvents;
};
return newChartClass;
}
return { createChart: createChart };
}();
// return module
return module; //---------------------------------------------------
// END code for this module
//---------------------------------------------------
}(modules_skeleton, modules_helper);
var modules_chartlet;
modules_chartlet = function (d3, helper) {
function NOOP(selection, done) {
done();
}
function Chartlet(enter, update, exit, customEvents) {
update = update || NOOP;
exit = exit || NOOP;
customEvents = customEvents || [];
var _propertyCache = {};
var _dispatch = d3.dispatch.apply(d3, [
'enterDone',
'updateDone',
'exitDone'
].concat(customEvents));
// getter and setter of chartlet properties
function property(name, value) {
// if functioning as a setter, set property in cache
if (arguments.length > 1) {
_propertyCache[name] = d3.functor(value);
return this;
}
// functioning as a getter, return property accessor
return d3.functor(_propertyCache[name]);
}
function getPropertyValue(name, d, i) {
return property(name)(d, i);
}
function _wrapAction(action, doneHookName) {
return function (selection) {
action(selection, helper.debounce(function (d, i) {
var doneHook = _dispatch[doneHookName];
if (doneHook) {
doneHook(selection);
}
}), 5);
};
}
function inheritPropertyFrom(chartlet, from, to) {
_propertyCache[to || from] = function (d, i) {
return chartlet.property(from)(d, i);
};
return this;
}
function inheritPropertiesFrom(chartlet, froms, tos) {
froms.forEach(function (from, i) {
inheritPropertyFrom(chartlet, from, tos && i < tos.length ? tos[i] : undefined);
});
return this;
}
function publishEventsTo(foreignDispatcher) {
customEvents.forEach(function (event) {
_dispatch.on(event, foreignDispatcher[event]);
});
return this;
}
function getCustomEventNames() {
return customEvents;
}
// exports
var exports = {
// for use by child chartlet
getDispatcher: function () {
return _dispatch;
},
getPropertyValue: getPropertyValue,
inheritPropertyFrom: inheritPropertyFrom,
inheritPropertiesFrom: inheritPropertiesFrom,
publishEventsTo: publishEventsTo,
getCustomEventNames: getCustomEventNames,
property: property,
enter: _wrapAction(enter, 'enterDone'),
update: _wrapAction(update, 'updateDone'),
exit: _wrapAction(exit, 'exitDone')
};
// bind events to exports
d3.rebind(exports, _dispatch, 'on');
// return exports
return exports;
}
// return module
return Chartlet;
}(d3, modules_helper);
var d3kit;
d3kit = function (factory, helper, Skeleton, LayerOrganizer, Chartlet) {
return {
factory: factory,
helper: helper,
Skeleton: Skeleton,
LayerOrganizer: LayerOrganizer,
Chartlet: Chartlet
};
}(modules_factory, modules_helper, modules_skeleton, modules_layerOrganizer, modules_chartlet);
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
return d3kit;
/******/ // Flag the module as loaded
/******/ module.loaded = true;
//---------------------------------------------------
// END code for this module
//---------------------------------------------------
}));
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.helper = exports.LayerOrganizer = exports.Chartlet = exports.Skeleton = exports.factory = undefined;
var _skeleton = __webpack_require__(1);
Object.defineProperty(exports, 'Skeleton', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_skeleton).default;
}
});
var _chartlet = __webpack_require__(6);
Object.defineProperty(exports, 'Chartlet', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_chartlet).default;
}
});
var _layerOrganizer = __webpack_require__(4);
Object.defineProperty(exports, 'LayerOrganizer', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_layerOrganizer).default;
}
});
var _helper = __webpack_require__(5);
Object.defineProperty(exports, 'helper', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_helper).default;
}
});
var _factory = __webpack_require__(7);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var factory = exports.factory = { createChart: _factory.createChart };
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _d3Selection = __webpack_require__(2);
var _d3Dispatch = __webpack_require__(3);
var _layerOrganizer = __webpack_require__(4);
var _layerOrganizer2 = _interopRequireDefault(_layerOrganizer);
var _helper = __webpack_require__(5);
var _helper2 = _interopRequireDefault(_helper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Constants
var DEFAULT_OPTIONS = {
margin: { top: 30, right: 30, bottom: 30, left: 30 },
offset: [0.5, 0.5],
initialWidth: 720,
initialHeight: 500
};
var BASE_EVENTS = ['data', 'options', 'resize'];
// Core Skeleton
function Skeleton(chartNode, customOptions, customEvents) {
var skeleton = {};
chartNode = _helper2.default.$(chartNode);
var _data = null;
var _options = _helper2.default.deepExtend({}, DEFAULT_OPTIONS, customOptions);
var _totalWidth = 0;
var _totalHeight = 0;
var _innerWidth = 0;
var _innerHeight = 0;
var _autoResizeDetection = 'window'; // either 'window' or 'dom';
var _autoResizeMode = false;
var _autoResizeFn = null;
var _autoResizeToAspectRatio = false;
// add svg element
var _svg = (0, _d3Selection.select)(chartNode).append('svg');
var _vis = _svg.append('g');
updateOffset();
var _layers = new _layerOrganizer2.default(_vis);
// setup event dispatcher
var _customEvents = customEvents ? customEvents.concat(BASE_EVENTS) : BASE_EVENTS;
var _dispatch = _d3Dispatch.dispatch.apply(this, _customEvents);
// set default dimension
dimension([_options.initialWidth, _options.initialHeight]);
function data(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _data;
}
// setter
_data = newValue;
// dispatch
if (!doNotDispatch) {
_dispatch.call('data', this, newValue);
}
return skeleton;
}
function options(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _options;
}
// setter
_options = _helper2.default.deepExtend(_options, newValue);
if (newValue) {
if (newValue.margin) {
updateMargin(doNotDispatch);
} else if (newValue.offset) {
// When the margin is changed,
// updateOffset() is already called within updateMargin()
// so "else if" is used here instead of "if".
// This will call updateOffset() manually
// only when margin is not changed and offset is changed.
updateOffset();
}
}
// dispatch
if (!doNotDispatch) {
_dispatch.call('options', this, newValue);
}
return skeleton;
}
function updateOffset() {
_vis.attr('transform', 'translate(' + (_options.margin.left + _options.offset[0]) + ',' + (_options.margin.top + _options.offset[1]) + ')');
}
function updateMargin(doNotDispatch) {
updateOffset();
_innerWidth = _totalWidth - _options.margin.left - _options.margin.right;
_innerHeight = _totalHeight - _options.margin.top - _options.margin.bottom;
if (!doNotDispatch) {
_dispatch.call('resize', this, [_totalWidth, _totalHeight, _innerWidth, _innerHeight]);
}
}
function margin(newValue, doNotDispatch) {
// getter
if (arguments.length === 0) {
return _options.margin;
}
// setter
_options.margin = _helper2.default.extend(_options.margin, newValue);
updateMargin(doNotDispatch);
return skeleton;
}
function offset(newValue) {
// getter
if (arguments.length === 0) {
return _options.offset;
}
// setter
_options.offset = newValue;
updateOffset();
return skeleton;
}
function width(newValue, doNotDispatch) {
// getter
if (arguments.length === 0 || newValue === null || newValue === undefined) {
return _totalWidth;
}
// setter
if (_helper2.default.isNumber(newValue)) {
_totalWidth = +newValue;
} else if (newValue.trim().toLowerCase() == 'auto') {
_totalWidth = chartNode.clientWidth;
} else {
_totalWidth = +(newValue + '').replace(/px/gi, '').trim();
}
if (_helper2.default.isNaN(_totalWidth)) {
throw Error('invalid width: ' + _totalWidth);
}
// round to integer
_totalWidth = Math.floor(_totalWidth);
_innerWidth = _totalWidth - _options.margin.left - _options.margin.right;
_svg.attr('width', _totalWidth);
// dispatch
if (!doNotDispatch) {
_dispatch.call('resize', this, [_totalWidth, _totalHeight, _innerWidth, _innerHeight]);
}
return skeleton;
}
function height(newValue, doNotDispatch) {
// getter
if (arguments.length === 0 || newValue === null || newValue === undefined) {
return _totalHeight;
}
// setter
if (_helper2.default.isNumber(newValue)) {
_totalHeight = +newValue;
} else if (newValue.trim().toLowerCase() == 'auto') {
_totalHeight = chartNode.clientHeight;
} else {
_totalHeight = +(newValue + '').replace(/px/gi, '').trim();
}
if (_helper2.default.isNaN(_totalHeight)) {
throw Error('invalid height: ' + _totalHeight);
}
// round to integer
_totalHeight = Math.floor(_totalHeight);
_innerHeight = _totalHeight - _options.margin.top - _options.margin.bottom;
_svg.attr('height', _totalHeight);
// dispatch
if (!doNotDispatch) {
_dispatch.call('resize', this, [_totalWidth, _totalHeight, _innerWidth, _innerHeight]);
}
return skeleton;
}
function dimension(values, doNotDispatch) {
if (arguments.length === 0) {
return [_totalWidth, _totalHeight];
}
width(values[0], true);
height(values[1], doNotDispatch);
return skeleton;
}
function autoResize(newMode) {
if (arguments.length === 0) {
return _autoResizeMode;
} else if (_autoResizeMode != newMode) {
return setupAutoResize(newMode, _autoResizeDetection);
}
return skeleton;
}
function autoResizeDetection(newDetection) {
if (arguments.length === 0) {
return _autoResizeDetection;
} else if (_autoResizeDetection != newDetection) {
return setupAutoResize(_autoResizeMode, newDetection);
}
return skeleton;
}
function autoResizeToAspectRatio(ratio) {
if (arguments.length === 0) {
return _autoResizeToAspectRatio;
}
if (ratio === null || ratio === undefined || ratio === '' || ratio === false || (ratio + '').toLowerCase() === 'false') {
_autoResizeToAspectRatio = false;
} else if (!_helper2.default.isNumber(ratio)) {
_autoResizeToAspectRatio = false;
} else if (+ratio === 0) {
_autoResizeToAspectRatio = false;
} else {
_autoResizeToAspectRatio = +ratio;
}
return skeleton;
}
function clearAutoResizeListener() {
if (_autoResizeFn) {
switch (_autoResizeDetection) {
case 'dom':
_helper2.default.off(chartNode, 'resize', _autoResizeFn);
break;
default:
case 'window':
_helper2.default.off(window, 'resize', _autoResizeFn);
break;
}
}
_autoResizeFn = null;
return skeleton;
}
function setAutoResizeListener(fn) {
if (fn) {
switch (_autoResizeDetection) {
case 'dom':
_helper2.default.on(chartNode, 'resize', fn);
break;
default:
case 'window':
_helper2.default.on(window, 'resize', fn);
break;
}
}
_autoResizeFn = fn;
return skeleton;
}
function setupAutoResize(newMode, newDetection) {
newMode = newMode && (newMode + '').toLowerCase() == 'false' ? false : newMode;
newDetection = newDetection || _autoResizeDetection;
// check if there is change in listener
if (newMode != _autoResizeMode) {
clearAutoResizeListener();
_autoResizeMode = newMode;
_autoResizeDetection = newDetection;
if (newMode) {
_autoResizeFn = _helper2.default.debounce(function () {
if (_autoResizeToAspectRatio) {
resizeToFitContainer(_autoResizeMode, true);
resizeToAspectRatio(_autoResizeToAspectRatio);
} else {
resizeToFitContainer(_autoResizeMode);
}
}, 100);
setAutoResizeListener(_autoResizeFn);
}
}
// change detection mode only
else if (newDetection != _autoResizeDetection) {
var oldAutoResizeFn = _autoResizeFn;
clearAutoResizeListener();
_autoResizeDetection = newDetection;
setAutoResizeListener(oldAutoResizeFn);
}
if (_autoResizeFn) _autoResizeFn();
return skeleton;
}
function getCustomEventNames() {
return customEvents || [];
}
function mixin(mixer) {
var self = skeleton;
if (_helper2.default.isObject(mixer)) {
Object.keys(mixer).forEach(function (key) {
self[key] = mixer[key];
});
}
return self;
}
// This function is only syntactic sugar
function resizeToFitContainer(mode, doNotDispatch) {
switch (mode) {
case 'all':
case 'full':
case 'both':
dimension(['auto', 'auto'], doNotDispatch);
break;
case 'height':
height('auto', doNotDispatch);
break;
default:
case 'width':
width('auto', doNotDispatch);
break;
}
return skeleton;
}
function resizeToAspectRatio(ratio, doNotDispatch) {
var w = _totalWidth;
var h = _totalHeight;
if (!_helper2.default.isNumber(ratio)) throw 'Invalid ratio: must be a Number';
ratio = +ratio;
// no need to resize if already at ratio
if ((w / h).toFixed(4) == ratio.toFixed(4)) return skeleton;
var estimatedH = Math.floor(w / ratio);
if (estimatedH > h) {
width(Math.floor(h * ratio), doNotDispatch);
} else {
height(estimatedH, doNotDispatch);
}
return skeleton;
}
function hasData() {
return _data !== null && _data !== undefined;
}
function hasNonZeroArea() {
return _innerWidth > 0 && _innerHeight > 0;
}
// define public fields and functions
_helper2.default.extend(skeleton, {
// getter only
getCustomEventNames: getCustomEventNames,
getDispatcher: function getDispatcher() {
return _dispatch;
},
getInnerWidth: function getInnerWidth() {
return _innerWidth;
},
getInnerHeight: function getInnerHeight() {
return _innerHeight;
},
getLayerOrganizer: function getLayerOrganizer() {
return _layers;
},
getRootG: function getRootG() {
return _vis;
},
getSvg: function getSvg() {
return _svg;
},
// getter & setter
data: data,
options: options,
margin: margin,
offset: offset,
width: width,
height: height,
dimension: dimension,
autoResize: autoResize,
autoResizeDetection: autoResizeDetection,
autoResizeToAspectRatio: autoResizeToAspectRatio,
// functions
hasData: hasData,
hasNonZeroArea: hasNonZeroArea,
mixin: mixin,
resizeToFitContainer: resizeToFitContainer,
resizeToAspectRatio: resizeToAspectRatio
});
// bind events
_helper2.default.rebind(skeleton, _dispatch, 'on');
return skeleton;
}
exports.default = Skeleton;
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (mainContainer, tag) {
var layers = {};
tag = tag || 'g';
function createLayerFromName(container, layerName, prefix) {
var id = prefix ? prefix + '.' + layerName : layerName;
if (layers.hasOwnProperty(id)) {
throw 'invalid or duplicate layer id: ' + id;
}
var layer = container.append(tag).classed(_helper2.default.dasherize(layerName) + '-layer', true);
layers[id] = layer;
return layer;
}
function createLayerFromInfo(container, layerInfo, prefix) {
if (Array.isArray(layerInfo)) {
return layerInfo.map(function (info) {
createLayerFromInfo(container, info, prefix);
});
} else if (_helper2.default.isObject(layerInfo)) {
var parentKey = Object.keys(layerInfo)[0];
var parentLayer = createLayerFromName(container, parentKey, prefix);
createLayerFromInfo(parentLayer, layerInfo[parentKey], prefix ? prefix + '.' + parentKey : parentKey);
return parentLayer;
} else {
return createLayerFromName(container, layerInfo, prefix);
}
}
function createLayer(layerInfo) {
return createLayerFromInfo(mainContainer, layerInfo);
}
function create(layerNames) {
if (Array.isArray(layerNames)) {
return layerNames.map(createLayer);
} else {
return createLayer(layerNames);
}
}
function get(layerName) {
return layers[layerName];
}
function has(layerName) {
return !!layers[layerName];
}
return {
create: create,
get: get,
has: has
};
};
var _helper = __webpack_require__(5);
var _helper2 = _interopRequireDefault(_helper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
/**
* Example usage:
* selection.call(d3Kit.helper.bindMouseEventsToDispatcher, dispatch, 'bar')
*
* @param {[type]} dispatch [description]
* @param {[type]} prefix [description]
* @return {[type]} [description]
*/
function bindMouseEventsToDispatcher(selection, dispatch, prefix) {
return selection.on('click', dispatch[prefix + 'Click']).on('mouseover', dispatch[prefix + 'MouseOver']).on('mousemove', dispatch[prefix + 'MouseMove']).on('mouseout', dispatch[prefix + 'MouseOut']);
}
function removeAllChildren(selection, noTransition) {
if (noTransition) {
return selection.selectAll('*').remove();
} else {
return selection.selectAll('*').transition().style('opacity', 0).remove();
}
}
// Returns true if it is a DOM element
// From http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
function isElement(o) {
return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? o instanceof HTMLElement : // DOM2
o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
}
var isNaN = Number.isNaN ? Number.isNaN : window.isNaN;
// Check whether s is element if not then do the querySelector
function $(s) {
return isElement(s) ? s : document.querySelector(s);
}
// To get a proper array from a NodeList that matches the CSS selector
function $$(s) {
return Array.isArray(s) ? s : [].slice.call(document.querySelectorAll(s));
}
//---------------------------------------------------
// From http://youmightnotneedjquery.com/
//---------------------------------------------------
function deepExtend(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
var obj = arguments[i];
if (!obj) continue;
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
var value = obj[key];
if (isObject(value) && !Array.isArray(value) && !isFunction(value)) {
out[key] = deepExtend(out[key], value);
} else out[key] = value;
}
}
}
return out;
}
function extend(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
if (!arguments[i]) continue;
for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key)) out[key] = arguments[i][key];
}
}
return out;
}
function on(element, type, listener) {
if (element.addEventListener) {
element.addEventListener(type, listener, false);
} else if (element.attachEvent) {
element.attachEvent('on' + type, listener);
}
}
function off(element, type, listener) {
element.removeEventListener(type, listener, false);
}
//---------------------------------------------------
// Modified from lodash
//---------------------------------------------------
/**
* Returns a function, that, as long as it continues to be invoked,
* will not be triggered.
* The function will be called after it stops being called for
* "wait" milliseconds.
* The output function can be called with .now() to execute immediately
* For example:
* doSomething(params); // will debounce
* doSomething.now(params); // will execute immediately
*
* @param Function func function to be debounced
* @param Number wait wait time until it will be executed
* @param Boolean immediate If "immediate" is passed, trigger the function on the
* leading edge, instead of the trailing.
* @return Function debounced function
*/
function debounce(func, wait, immediate) {
var timeout = void 0;
var outputFn = function outputFn() {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
// return caller for chaining
return context;
};
// so we know this function is debounced
outputFn.isDebounced = true;
// and provide a way to call the original function immediately
outputFn.now = function () {
clearTimeout(timeout);
return func.apply(this, arguments);
};
return outputFn;
}
//---------------------------------------------------
// From lodash
//---------------------------------------------------
/** Used to determine if values are of the language type Object */
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// http://code.google.com/p/v8/issues/detail?id=2291
return !!(value && objectTypes[typeof value === 'undefined' ? 'undefined' : _typeof(value)]);
}
/** `Object#toString` result shortcuts */
var numberClass = '[object Number]';
/** Used for native method references */
var objectProto = Object.prototype;
/** Used to resolve the internal [[Class]] of values */
var toString = objectProto.toString;
/**
* Checks if `value` is a number.
*
* Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
*
* @static
* @memberOf _
* @category Objects
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if the `value` is a number, else `false`.
* @example
*
* _.isNumber(8.4 * 5);
* // => true
*/
function isNumber(value) {
return typeof value == 'number' || value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object' && toString.call(value) == numberClass || false;
}
function isFunction(functionToCheck) {
var getType = {};
return !!functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}
//---------------------------------------------------
// From underscore.string
//---------------------------------------------------
/* jshint ignore:start */
var nativeTrim = String.prototype.trim;
function escapeRegExp(str) {
if (str == null) return '';
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}
var defaultToWhiteSpace = function defaultToWhiteSpace(characters) {
if (characters == null) return '\\s';else if (characters.source) return characters.source;else return '[' + escapeRegExp(characters) + ']';
};
function trim(str, characters) {
if (str == null) return '';
if (!characters && nativeTrim) return nativeTrim.call(str);
characters = defaultToWhiteSpace(characters);
return String(str).replace(new RegExp('\^' + characters + '+|' + characters + '+$', 'g'), '');
}
function dasherize(str) {
return trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
}
// Copies a variable number of methods from source to target.
function rebind(target, source) {
var i = 1,
n = arguments.length,
method = void 0;
while (++i < n) {
target[method = arguments[i]] = d3_rebind(target, source, source[method]);
}return target;
}
// Method is assumed to be a standard D3 getter-setter:
// If passed with no arguments, gets the value.
// If passed with arguments, sets the value and returns the target.
function d3_rebind(target, source, method) {
return function () {
var value = method.apply(source, arguments);
return value === source ? target : value;
};
}
function functor(v) {
return typeof v === 'function' ? v : function () {
return v;
};
}
/* jshint ignore:end */
exports.default = {
$: $,
$$: $$,
dasherize: dasherize,
debounce: debounce,
deepExtend: deepExtend,
extend: extend,
isElement: isElement,
isFunction: isFunction,
isNaN: isNaN,
isNumber: isNumber,
isObject: isObject,
on: on,
off: off,
trim: trim,
rebind: rebind,
functor: functor,
removeAllChildren: removeAllChildren,
bindMouseEventsToDispatcher: bindMouseEventsToDispatcher
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _d3Dispatch = __webpack_require__(3);
var _helper = __webpack_require__(5);
var _helper2 = _interopRequireDefault(_helper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function NOOP(selection, done) {
done();
}
function Chartlet(enter, update, exit, customEvents) {
update = update || NOOP;
exit = exit || NOOP;
customEvents = customEvents || [];
var _propertyCache = {};
var _dispatch = _d3Dispatch.dispatch.apply(this, ['enterDone', 'updateDone', 'exitDone'].concat(customEvents));
// getter and setter of chartlet properties
function property(name, value) {
// if functioning as a setter, set property in cache
if (arguments.length > 1) {
_propertyCache[name] = _helper2.default.functor(value);
return this;
}
// functioning as a getter, return property accessor
return _helper2.default.functor(_propertyCache[name]);
}
function getPropertyValue(name, d, i) {
return property(name)(d, i);
}
function _wrapAction(action, doneHookName) {
return function (selection) {
action(selection, _helper2.default.debounce(function (d, i) {
_dispatch.call(doneHookName, this, selection);
}), 5);
};
}
function inheritPropertyFrom(chartlet, from, to) {
_propertyCache[to || from] = function (d, i) {
return chartlet.property(from)(d, i);
};
return this;
}
function inheritPropertiesFrom(chartlet, froms, tos) {
froms.forEach(function (from, i) {
inheritPropertyFrom(chartlet, from, tos && i < tos.length ? tos[i] : undefined);
});
return this;
}
function publishEventsTo(foreignDispatcher) {
customEvents.forEach(function (event) {
_dispatch.on(event, function () {
var args = Array.prototype.slice.call(arguments);
foreignDispatcher.apply(event, this, args);
});
});
return this;
}
function getCustomEventNames() {
return customEvents;
}
// exports
var exports = {
// for use by child chartlet
getDispatcher: function getDispatcher() {
return _dispatch;
},
getPropertyValue: getPropertyValue,
inheritPropertyFrom: inheritPropertyFrom,
inheritPropertiesFrom: inheritPropertiesFrom,
publishEventsTo: publishEventsTo,
getCustomEventNames: getCustomEventNames,
property: property,
enter: _wrapAction(enter, 'enterDone'),
update: _wrapAction(update, 'updateDone'),
exit: _wrapAction(exit, 'exitDone')
};
// bind events to exports
_helper2.default.rebind(exports, _dispatch, 'on');
// return exports
return exports;
}
exports.default = Chartlet;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createChart = createChart;
var _skeleton = __webpack_require__(1);
var _skeleton2 = _interopRequireDefault(_skeleton);
var _helper = __webpack_require__(5);
var _helper2 = _interopRequireDefault(_helper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Return a constructor for your custom chart type
* @param Object defaultOptions default options for your chart
* @param Array[String] customEvents list of custom events this chart will dispatch
* @param Function constructor constructor function function(skeleton){...}
* @return Function function(chartNode, options) that return your chart
*/
function createChart(defaultOptions, customEvents, constructor) {
var newChartClass = function newChartClass(chartNode, options) {
var skeleton = new _skeleton2.default(chartNode, _helper2.default.deepExtend({}, defaultOptions, options), customEvents);
if (constructor) constructor(skeleton);
return skeleton;
};
customEvents = customEvents ? customEvents : [];
/**
* Return supported custom events for this chart class.
* This is a static method for class, not instance method.
* @return Array[String] names of custom events
*/
newChartClass.getCustomEvents = function () {
return customEvents;
};
return newChartClass;
}
/***/ }
/******/ ])
});
;

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

!function(a,b){"function"==typeof define&&define.amd?define(["d3"],b):"object"==typeof exports?module.exports=b(require("d3")):a.d3Kit=b(a.d3)}(this,function(a){var b;b=function(){var a=function(){function a(a,b,c){return a.on("click",b[c+"Click"]).on("mouseover",b[c+"MouseOver"]).on("mousemove",b[c+"MouseMove"]).on("mouseout",b[c+"MouseOut"])}function b(a,b){return b?a.selectAll("*").remove():a.selectAll("*").transition().style("opacity",0).remove()}function c(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&null!==a&&1===a.nodeType&&"string"==typeof a.nodeName}function d(a){return c(a)?a:document.querySelector(a)}function e(a){return Array.isArray(a)?a:[].slice.call(document.querySelectorAll(a))}function f(a){a=a||{};for(var b=1;b<arguments.length;b++){var c=arguments[b];if(c)for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];!k(e)||Array.isArray(e)||m(e)?a[d]=e:a[d]=f(a[d],e)}}return a}function g(a){a=a||{};for(var b=1;b<arguments.length;b++)if(arguments[b])for(var c in arguments[b])arguments[b].hasOwnProperty(c)&&(a[c]=arguments[b][c]);return a}function h(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function i(a,b,c){a.removeEventListener(b,c,!1)}function j(a,b,c){var d,e=function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;return clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f),e};return e.isDebounced=!0,e.now=function(){return clearTimeout(d),a.apply(this,arguments)},e}function k(a){return!(!a||!r[typeof a])}function l(a){return"number"==typeof a||a&&"object"==typeof a&&u.call(a)==s||!1}function m(a){var b={};return!!a&&"[object Function]"===b.toString.call(a)}function n(a){return null==a?"":String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function o(a,b){return null==a?"":!b&&v?v.call(a):(b=w(b),String(a).replace(new RegExp("^"+b+"+|"+b+"+$","g"),""))}function p(a){return o(a).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}var q=Number.isNaN?Number.isNaN:window.isNaN,r={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},s="[object Number]",t=Object.prototype,u=t.toString,v=String.prototype.trim,w=function(a){return null==a?"\\s":a.source?a.source:"["+n(a)+"]"};return{$:d,$$:e,dasherize:p,debounce:j,deepExtend:f,extend:g,isElement:c,isFunction:m,isNaN:q,isNumber:l,isObject:k,on:h,off:i,trim:o,removeAllChildren:b,bindMouseEventsToDispatcher:a}}();return a}();var c;c=function(a){return function(b,c){function d(b,d,e){var f=e?e+"."+d:d;if(j.hasOwnProperty(f))throw"invalid or duplicate layer id: "+f;var g=b.append(c).classed(a.dasherize(d)+"-layer",!0);return j[f]=g,g}function e(b,c,f){if(Array.isArray(c))return c.map(function(a){e(b,a,f)});if(a.isObject(c)){var g=Object.keys(c)[0],h=d(b,g,f);return e(h,c[g],f?f+"."+g:g),h}return d(b,c,f)}function f(a){return e(b,a)}function g(a){return Array.isArray(a)?a.map(f):f(a)}function h(a){return j[a]}function i(a){return!!j[a]}var j={};return c=c||"g",{create:g,get:h,has:i}}}(b);var d;d=function(a,b,c){function d(d,g,h){function i(a,b){return 0===arguments.length?E:(E=a,b||S.data(a),D)}function j(a,b){return 0===arguments.length?F:(F=c.deepExtend(F,a),a&&(a.margin?l(b):a.offset&&k()),b||S.options(a),D)}function k(){P.attr("transform","translate("+(F.margin.left+F.offset[0])+","+(F.margin.top+F.offset[1])+")")}function l(a){k(),I=G-F.margin.left-F.margin.right,J=H-F.margin.top-F.margin.bottom,a||S.resize([G,H,I,J])}function m(a,b){return 0===arguments.length?F.margin:(F.margin=c.extend(F.margin,a),l(b),D)}function n(a){return 0===arguments.length?F.offset:(F.offset=a,k(),D)}function o(a,b){if(0===arguments.length||null===a||void 0===a)return G;if(G=c.isNumber(a)?+a:"auto"==a.trim().toLowerCase()?d.clientWidth:+(a+"").replace(/px/gi,"").trim(),c.isNaN(G))throw Error("invalid width: "+G);return G=Math.floor(G),I=G-F.margin.left-F.margin.right,O.attr("width",G),b||S.resize([G,H,I,J]),D}function p(a,b){if(0===arguments.length||null===a||void 0===a)return H;if(H=c.isNumber(a)?+a:"auto"==a.trim().toLowerCase()?d.clientHeight:+(a+"").replace(/px/gi,"").trim(),c.isNaN(H))throw Error("invalid height: "+H);return H=Math.floor(H),J=H-F.margin.top-F.margin.bottom,O.attr("height",H),b||S.resize([G,H,I,J]),D}function q(a,b){return 0===arguments.length?[G,H]:(o(a[0],!0),p(a[1],b),D)}function r(a){return 0===arguments.length?L:L!=a?w(a,K):D}function s(a){return 0===arguments.length?K:K!=a?w(L,a):D}function t(a){return 0===arguments.length?N:(N=null===a||void 0===a||""===a||a===!1||"false"===(a+"").toLowerCase()?!1:c.isNumber(a)?0===+a?!1:+a:!1,D)}function u(){if(M)switch(K){case"dom":c.off(d,"resize",M);break;default:case"window":c.off(window,"resize",M)}return M=null,D}function v(a){if(a)switch(K){case"dom":c.on(d,"resize",a);break;default:case"window":c.on(window,"resize",a)}return M=a,D}function w(a,b){if(a=a&&"false"==(a+"").toLowerCase()?!1:a,b=b||K,a!=L)u(),L=a,K=b,a&&(M=c.debounce(function(){N?(z(L,!0),A(N)):z(L)},100),v(M));else if(b!=K){var d=M;u(),K=b,v(d)}return M&&M(),D}function x(){return Object.keys(S).filter(function(a){return f.indexOf(a)<0})}function y(a){var b=D;return c.isObject(a)&&Object.keys(a).forEach(function(c){b[c]=a[c]}),b}function z(a,b){switch(a){case"all":case"full":case"both":q(["auto","auto"],b);break;case"height":p("auto",b);break;default:case"width":o("auto",b)}return D}function A(a,b){var d=G,e=H;if(!c.isNumber(a))throw"Invalid ratio: must be a Number";if(a=+a,(d/e).toFixed(4)==a.toFixed(4))return D;var f=Math.floor(d/a);return f>e?o(Math.floor(e*a),b):p(f,b),D}function B(){return null!==E&&void 0!==E}function C(){return I>0&&J>0}var D={};d=c.$(d);var E=null,F=c.deepExtend({},e,g),G=0,H=0,I=0,J=0,K="window",L=!1,M=null,N=!1,O=a.select(d).append("svg"),P=O.append("g");k();var Q=new b(P),R=h?h.concat(f):f,S=a.dispatch.apply(a,R);return q([F.initialWidth,F.initialHeight]),c.extend(D,{getCustomEventNames:x,getDispatcher:function(){return S},getInnerWidth:function(){return I},getInnerHeight:function(){return J},getLayerOrganizer:function(){return Q},getRootG:function(){return P},getSvg:function(){return O},data:i,options:j,margin:m,offset:n,width:o,height:p,dimension:q,autoResize:r,autoResizeDetection:s,autoResizeToAspectRatio:t,hasData:B,hasNonZeroArea:C,mixin:y,resizeToFitContainer:z,resizeToAspectRatio:A}),a.rebind(D,S,"on"),D}var e={margin:{top:30,right:30,bottom:30,left:30},offset:[.5,.5],initialWidth:720,initialHeight:500},f=["data","options","resize"];return d}(a,c,b);var e;e=function(a,b){var c=function(){function c(c,d,e){var f=function(f,g){var h=new a(f,b.deepExtend({},c,g),d);return e&&e(h),h};return d=d?d:[],f.getCustomEvents=function(){return d},f}return{createChart:c}}();return c}(d,b);var f;f=function(a,b){function c(a,b){b()}function d(d,e,f,g){function h(b,c){return arguments.length>1?(o[b]=a.functor(c),this):a.functor(o[b])}function i(a,b,c){return h(a)(b,c)}function j(a,c){return function(d){a(d,b.debounce(function(a,b){var e=p[c];e&&e(d)}),5)}}function k(a,b,c){return o[c||b]=function(c,d){return a.property(b)(c,d)},this}function l(a,b,c){return b.forEach(function(b,d){k(a,b,c&&d<c.length?c[d]:void 0)}),this}function m(a){return g.forEach(function(b){p.on(b,a[b])}),this}function n(){return g}e=e||c,f=f||c,g=g||[];var o={},p=a.dispatch.apply(a,["enterDone","updateDone","exitDone"].concat(g)),q={getDispatcher:function(){return p},getPropertyValue:i,inheritPropertyFrom:k,inheritPropertiesFrom:l,publishEventsTo:m,getCustomEventNames:n,property:h,enter:j(d,"enterDone"),update:j(e,"updateDone"),exit:j(f,"exitDone")};return a.rebind(q,p,"on"),q}return d}(a,b);var g;return g=function(a,b,c,d,e){return{factory:a,helper:b,Skeleton:c,LayerOrganizer:d,Chartlet:e}}(e,b,d,c,f)});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["d3-selection","d3-dispatch"],t):"object"==typeof exports?exports.d3Kit=t(require("d3-selection"),require("d3-dispatch")):e.d3Kit=t(e.d3,e.d3)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.helper=t.LayerOrganizer=t.Chartlet=t.Skeleton=t.factory=void 0;var o=n(1);Object.defineProperty(t,"Skeleton",{enumerable:!0,get:function(){return r(o)["default"]}});var i=n(6);Object.defineProperty(t,"Chartlet",{enumerable:!0,get:function(){return r(i)["default"]}});var u=n(4);Object.defineProperty(t,"LayerOrganizer",{enumerable:!0,get:function(){return r(u)["default"]}});var a=n(5);Object.defineProperty(t,"helper",{enumerable:!0,get:function(){return r(a)["default"]}});var f=n(7);t.factory={createChart:f.createChart}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(e,t){return 0===arguments.length?P:(P=e,t||Z.call("data",this,e),C)}function o(e,t){return 0===arguments.length?L:(L=l["default"].deepExtend(L,e),e&&(e.margin?c(t):e.offset&&a()),t||Z.call("options",this,e),C)}function a(){W.attr("transform","translate("+(L.margin.left+L.offset[0])+","+(L.margin.top+L.offset[1])+")")}function c(e){a(),T=S-L.margin.left-L.margin.right,k=D-L.margin.top-L.margin.bottom,e||Z.call("resize",this,[S,D,T,k])}function p(e,t){return 0===arguments.length?L.margin:(L.margin=l["default"].extend(L.margin,e),c(t),C)}function h(e){return 0===arguments.length?L.offset:(L.offset=e,a(),C)}function m(t,n){if(0===arguments.length||null===t||void 0===t)return S;if(S=l["default"].isNumber(t)?+t:"auto"==t.trim().toLowerCase()?e.clientWidth:+(t+"").replace(/px/gi,"").trim(),l["default"].isNaN(S))throw Error("invalid width: "+S);return S=Math.floor(S),T=S-L.margin.left-L.margin.right,q.attr("width",S),n||Z.call("resize",this,[S,D,T,k]),C}function g(t,n){if(0===arguments.length||null===t||void 0===t)return D;if(D=l["default"].isNumber(t)?+t:"auto"==t.trim().toLowerCase()?e.clientHeight:+(t+"").replace(/px/gi,"").trim(),l["default"].isNaN(D))throw Error("invalid height: "+D);return D=Math.floor(D),k=D-L.margin.top-L.margin.bottom,q.attr("height",D),n||Z.call("resize",this,[S,D,T,k]),C}function v(e,t){return 0===arguments.length?[S,D]:(m(e[0],!0),g(e[1],t),C)}function y(e){return 0===arguments.length?F:F!=e?N(e,$):C}function b(e){return 0===arguments.length?$:$!=e?N(F,e):C}function w(e){return 0===arguments.length?R:(R=null!==e&&void 0!==e&&""!==e&&e!==!1&&"false"!==(e+"").toLowerCase()&&(!!l["default"].isNumber(e)&&(0!==+e&&+e)),C)}function x(){if(H)switch($){case"dom":l["default"].off(e,"resize",H);break;default:case"window":l["default"].off(window,"resize",H)}return H=null,C}function j(t){if(t)switch($){case"dom":l["default"].on(e,"resize",t);break;default:case"window":l["default"].on(window,"resize",t)}return H=t,C}function N(e,t){if(e=(!e||"false"!=(e+"").toLowerCase())&&e,t=t||$,e!=F)x(),F=e,$=t,e&&(H=l["default"].debounce(function(){R?(M(F,!0),_(R)):M(F)},100),j(H));else if(t!=$){var n=H;x(),$=t,j(n)}return H&&H(),C}function E(){return n||[]}function O(e){var t=C;return l["default"].isObject(e)&&Object.keys(e).forEach(function(n){t[n]=e[n]}),t}function M(e,t){switch(e){case"all":case"full":case"both":v(["auto","auto"],t);break;case"height":g("auto",t);break;default:case"width":m("auto",t)}return C}function _(e,t){var n=S,r=D;if(!l["default"].isNumber(e))throw"Invalid ratio: must be a Number";if(e=+e,(n/r).toFixed(4)==e.toFixed(4))return C;var o=Math.floor(n/e);return o>r?m(Math.floor(r*e),t):g(o,t),C}function z(){return null!==P&&void 0!==P}function A(){return T>0&&k>0}var C={};e=l["default"].$(e);var P=null,L=l["default"].deepExtend({},s,t),S=0,D=0,T=0,k=0,$="window",F=!1,H=null,R=!1,q=(0,i.select)(e).append("svg"),W=q.append("g");a();var I=new f["default"](W),K=n?n.concat(d):d,Z=u.dispatch.apply(this,K);return v([L.initialWidth,L.initialHeight]),l["default"].extend(C,{getCustomEventNames:E,getDispatcher:function(){return Z},getInnerWidth:function(){return T},getInnerHeight:function(){return k},getLayerOrganizer:function(){return I},getRootG:function(){return W},getSvg:function(){return q},data:r,options:o,margin:p,offset:h,width:m,height:g,dimension:v,autoResize:y,autoResizeDetection:b,autoResizeToAspectRatio:w,hasData:z,hasNonZeroArea:A,mixin:O,resizeToFitContainer:M,resizeToAspectRatio:_}),l["default"].rebind(C,Z,"on"),C}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),u=n(3),a=n(4),f=r(a),c=n(5),l=r(c),s={margin:{top:30,right:30,bottom:30,left:30},offset:[.5,.5],initialWidth:720,initialHeight:500},d=["data","options","resize"];t["default"]=o},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){function n(e,n,r){var o=r?r+"."+n:n;if(c.hasOwnProperty(o))throw"invalid or duplicate layer id: "+o;var u=e.append(t).classed(i["default"].dasherize(n)+"-layer",!0);return c[o]=u,u}function r(e,t,o){if(Array.isArray(t))return t.map(function(t){r(e,t,o)});if(i["default"].isObject(t)){var u=Object.keys(t)[0],a=n(e,u,o);return r(a,t[u],o?o+"."+u:u),a}return n(e,t,o)}function o(t){return r(e,t)}function u(e){return Array.isArray(e)?e.map(o):o(e)}function a(e){return c[e]}function f(e){return!!c[e]}var c={};return t=t||"g",{create:u,get:a,has:f}};var o=n(5),i=r(o)},function(e,t){"use strict";function n(e,t,n){return e.on("click",t[n+"Click"]).on("mouseover",t[n+"MouseOver"]).on("mousemove",t[n+"MouseMove"]).on("mouseout",t[n+"MouseOut"])}function r(e,t){return t?e.selectAll("*").remove():e.selectAll("*").transition().style("opacity",0).remove()}function o(e){return"object"===("undefined"==typeof HTMLElement?"undefined":x(HTMLElement))?e instanceof HTMLElement:e&&"object"===("undefined"==typeof e?"undefined":x(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}function i(e){return o(e)?e:document.querySelector(e)}function u(e){return Array.isArray(e)?e:[].slice.call(document.querySelectorAll(e))}function a(e){e=e||{};for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n)for(var r in n)if(n.hasOwnProperty(r)){var o=n[r];!d(o)||Array.isArray(o)||h(o)?e[r]=o:e[r]=a(e[r],o)}}return e}function f(e){e=e||{};for(var t=1;t<arguments.length;t++)if(arguments[t])for(var n in arguments[t])arguments[t].hasOwnProperty(n)&&(e[n]=arguments[t][n]);return e}function c(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function l(e,t,n){e.removeEventListener(t,n,!1)}function s(e,t,n){var r=void 0,o=function(){var o=this,i=arguments,u=function(){r=null,n||e.apply(o,i)},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&e.apply(o,i),o};return o.isDebounced=!0,o.now=function(){return clearTimeout(r),e.apply(this,arguments)},o}function d(e){return!(!e||!N["undefined"==typeof e?"undefined":x(e)])}function p(e){return"number"==typeof e||e&&"object"==("undefined"==typeof e?"undefined":x(e))&&M.call(e)==E||!1}function h(e){var t={};return!!e&&"[object Function]"===t.toString.call(e)}function m(e){return null==e?"":String(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function g(e,t){return null==e?"":!t&&_?_.call(e):(t=z(t),String(e).replace(new RegExp("^"+t+"+|"+t+"+$","g"),""))}function v(e){return g(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}function y(e,t){for(var n=1,r=arguments.length,o=void 0;++n<r;)e[o=arguments[n]]=b(e,t,t[o]);return e}function b(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function w(e){return"function"==typeof e?e:function(){return e}}Object.defineProperty(t,"__esModule",{value:!0});var x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},j=Number.isNaN?Number.isNaN:window.isNaN,N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},E="[object Number]",O=Object.prototype,M=O.toString,_=String.prototype.trim,z=function(e){return null==e?"\\s":e.source?e.source:"["+m(e)+"]"};t["default"]={$:i,$$:u,dasherize:v,debounce:s,deepExtend:a,extend:f,isElement:o,isFunction:h,isNaN:j,isNumber:p,isObject:d,on:c,off:l,trim:g,rebind:y,functor:w,removeAllChildren:r,bindMouseEventsToDispatcher:n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){t()}function i(e,t,n,r){function i(e,t){return arguments.length>1?(h[e]=f["default"].functor(t),this):f["default"].functor(h[e])}function a(e,t,n){return i(e)(t,n)}function c(e,t){return function(n){e(n,f["default"].debounce(function(e,r){m.call(t,this,n)}),5)}}function l(e,t,n){return h[n||t]=function(n,r){return e.property(t)(n,r)},this}function s(e,t,n){return t.forEach(function(t,r){l(e,t,n&&r<n.length?n[r]:void 0)}),this}function d(e){return r.forEach(function(t){m.on(t,function(){var n=Array.prototype.slice.call(arguments);e.apply(t,this,n)})}),this}function p(){return r}t=t||o,n=n||o,r=r||[];var h={},m=u.dispatch.apply(this,["enterDone","updateDone","exitDone"].concat(r)),g={getDispatcher:function(){return m},getPropertyValue:a,inheritPropertyFrom:l,inheritPropertiesFrom:s,publishEventsTo:d,getCustomEventNames:p,property:i,enter:c(e,"enterDone"),update:c(t,"updateDone"),exit:c(n,"exitDone")};return f["default"].rebind(g,m,"on"),g}Object.defineProperty(t,"__esModule",{value:!0});var u=n(3),a=n(5),f=r(a);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){var r=function(r,o){var i=new u["default"](r,f["default"].deepExtend({},e,o),t);return n&&n(i),i};return t=t?t:[],r.getCustomEvents=function(){return t},r}Object.defineProperty(t,"__esModule",{value:!0}),t.createChart=o;var i=n(1),u=r(i),a=n(5),f=r(a)}])});
{
"name": "d3kit",
"version": "1.1.0",
"version": "2.0.0-rc1",
"description": "A kit of tools to speed D3 related project development.",
"main": "dist/d3kit.min.js",
"dependencies": {
"d3": "~3.5.16"
},
"devDependencies": {
"amdclean": "^2.2.7",
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-requirejs": "~0.4.4",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-exec": "^0.4.6",
"grunt-karma": "~0.8.3",
"karma": "~0.12.21",
"karma-chrome-launcher": "~0.1.4",
"karma-coverage": "~0.2.6",
"karma-firefox-launcher": "~0.1.3",
"karma-mocha": "^0.1.8",
"karma-mocha-reporter": "~0.2.8",
"karma-phantomjs-launcher": "~0.1.4",
"karma-requirejs": "~0.2.2",
"load-grunt-config": "~0.17.1",
"mocha": "^1.21.4",
"time-grunt": "~1.2.1"
},
"scripts": {
"build": "grunt build",
"test": "grunt test-ci",
"preversion": "npm test",
"version": "npm run build && git add -A dist",
"postversion": "git push ; git push --tags"
},
"repository": {

@@ -46,7 +11,74 @@ "type": "git",

"d3",
"d3kit",
"visualization",
"javascript"
],
"author": "@kristw, @trebor",
"license": "MIT"
"author": [
"Krist Wongsuphasawat <kristw@twitter.com> (http://kristw.yellowpigz.com)",
"Robert Harris <rharris@twitter.com>"
],
"license": "MIT",
"main": "dist/d3kit.min.js",
"files": [
"src/**/*.*",
"dist/*.*"
],
"peerDependencies": {
"d3-dispatch": "~1.0.1",
"d3-selection": "~1.0.2"
},
"devDependencies": {
"babel-core": "^6.3.21",
"babel-loader": "^6.2.0",
"babel-plugin-transform-object-assign": "^6.1.12",
"babel-preset-es2015": "^6.3.13",
"bower": "^1.6.5",
"browser-sync": "~2.14.0",
"chai": "^3.5.0",
"d3-dispatch": "~1.0.1",
"d3-selection": "~1.0.2",
"del": "^2.2.0",
"eslint": "^3.1.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.12.0",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-mocha": "^4.3.0",
"gh-pages": "^0.11.0",
"gulp": "^3.9.0",
"gulp-load-plugins": "^1.1.0",
"gulp-newer": "~1.1.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "~1.5.4",
"istanbul-instrumenter-loader": "~0.1.3",
"karma": "~0.13.15",
"karma-chai": "^0.1.0",
"karma-coverage": "~0.5.3",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.1.0",
"karma-phantomjs-launcher": "^1.0.1",
"karma-sourcemap-loader": "~0.3.6",
"karma-webpack": "~1.7.0",
"mocha": "^3.0.2",
"pkgfiles": "^2.3.0",
"run-sequence": "^1.1.5",
"webpack": "^1.12.9",
"webpack-stream": "^3.1.0"
},
"scripts": {
"gh-pages": "npm run build && gh-pages -d dist",
"test": "karma start --single-run",
"tdd": "karma start",
"build": "NODE_ENV=production gulp build",
"dev": "gulp",
"start": "NODE_ENV=production gulp",
"eslint": "eslint --ignore-path .gitignore \"src/**/*.@(js|jsx)\"",
"eslint-fix": "eslint --fix --ignore-path .gitignore \"src/**/*.@(js|jsx)\"",
"preversion": "npm test",
"version": "npm run build && git add -A dist",
"postversion": "git push ; git push --tags; pkgfiles",
"prepublish": "pkgfiles"
},
"engines": {
"node": "~6.3"
}
}
## d3Kit
[![Build Status](https://secure.travis-ci.org/twitter/d3kit.png?branch=master)](http://travis-ci.org/twitter/d3kit)
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]

@@ -41,3 +41,3 @@ **d3Kit** is a set of thin scaffolds and utilities for speeding visualization development with [D3](https://github.com/mbostock/d3).

```
npm install d3kit --save
npm install d3-selection d3-dispatch d3kit --save
```

@@ -49,1 +49,9 @@

* Krist Wongsuphasawat [@kristw](https://twitter.com/kristw)
[npm-image]: https://badge.fury.io/js/d3kit.svg
[npm-url]: https://npmjs.org/package/d3kit
[travis-image]: https://travis-ci.org/twitter/d3kit.svg?branch=master
[travis-url]: https://travis-ci.org/twitter/d3kit
[daviddm-image]: https://david-dm.org/twitter/d3kit.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/twitter/d3kit
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