react-d3-core
Advanced tools
Comparing version 1.1.4 to 1.1.5
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -21,5 +13,5 @@ | ||
var _d3 = require('d3'); | ||
var _d = require('d3'); | ||
var _d32 = _interopRequireDefault(_d3); | ||
var _d2 = _interopRequireDefault(_d); | ||
@@ -30,5 +22,13 @@ var _reactFauxDom = require('react-faux-dom'); | ||
var _utilsScale = require('../utils/scale'); | ||
var _scale = require('../utils/scale'); | ||
var Axis = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Axis = function (_Component) { | ||
_inherits(Axis, _Component); | ||
@@ -39,3 +39,3 @@ | ||
_get(Object.getPrototypeOf(Axis.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Axis).call(this, props)); | ||
} | ||
@@ -55,4 +55,5 @@ | ||
var func = _d32['default'].svg.axis(); | ||
var func = _d2.default.svg.axis(); | ||
func.scale(this._mkScale(this.props)); | ||
@@ -79,4 +80,5 @@ | ||
var func = (0, _utilsScale.scale)(this.props); | ||
var func = (0, _scale.scale)(this.props); | ||
return func; | ||
@@ -94,4 +96,5 @@ } | ||
var axisGroup = _reactFauxDom2['default'].createElement('g'); | ||
var axisGroup = _reactFauxDom2.default.createElement('g'); | ||
if (type === 'x') var axisClasses = axisClassName + ' axis x';else if (type === 'y') var axisClasses = axisClassName + ' axis y';else if (type === 'gridx' || type === 'gridy') var axisClasses = gridAxisClassName + ' grid-axis'; | ||
@@ -101,3 +104,3 @@ | ||
var axisDom = _d32['default'].select(axisGroup); | ||
var axisDom = _d2.default.select(axisGroup); | ||
@@ -134,27 +137,20 @@ axisDom.call(this._mkTickAxis()); | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: { | ||
range: null, | ||
rangeRoundBands: null, | ||
domain: null, | ||
tickFormat: null, | ||
tickOrient: null | ||
}, | ||
enumerable: true | ||
}, { | ||
key: 'PropTypes', | ||
value: { | ||
showAxis: _react.PropTypes.bool, | ||
type: _react.PropTypes.string, | ||
orient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']), | ||
tickOrient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']) | ||
}, | ||
enumerable: true | ||
}]); | ||
return Axis; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Axis; | ||
module.exports = exports['default']; | ||
Axis.defaultProps = { | ||
range: null, | ||
rangeRoundBands: null, | ||
domain: null, | ||
tickFormat: null, | ||
tickOrient: null | ||
}; | ||
Axis.PropTypes = { | ||
showAxis: _react.PropTypes.bool, | ||
type: _react.PropTypes.string, | ||
orient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']), | ||
tickOrient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']) | ||
}; | ||
exports.default = Axis; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -21,5 +15,5 @@ | ||
var _d3 = require('d3'); | ||
var _d = require('d3'); | ||
var _d32 = _interopRequireDefault(_d3); | ||
var _d2 = _interopRequireDefault(_d); | ||
@@ -34,3 +28,11 @@ var _reactFauxDom = require('react-faux-dom'); | ||
var Label = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Label = function (_Component) { | ||
_inherits(Label, _Component); | ||
@@ -41,3 +43,3 @@ | ||
_get(Object.getPrototypeOf(Label.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Label).call(this, props)); | ||
} | ||
@@ -59,3 +61,4 @@ | ||
var labelDom = _d32['default'].select(dom); | ||
var labelDom = _d2.default.select(dom); | ||
var fixWidth = width - margins.left - margins.right; | ||
@@ -85,3 +88,4 @@ var fixHeight = height - margins.top - margins.bottom; | ||
var labelText = _reactFauxDom2['default'].createElement('text'); | ||
var labelText = _reactFauxDom2.default.createElement('text'); | ||
var labelClasses = labelClassName + ' label'; | ||
@@ -94,35 +98,28 @@ labelText.setAttribute('class', labelClasses); | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
hTransform: 'rotate(0)', | ||
vTransform: 'rotate(270)', | ||
labelTitle: 'label title', | ||
labelPosition: 'bottom', | ||
labelOffset: 40, | ||
textAnchor: 'middle', | ||
labelClassName: 'react-d3-core__label' | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
hTransform: _react.PropTypes.string, | ||
vTransform: _react.PropTypes.string, | ||
labelTitle: _react.PropTypes.string, | ||
labelPosition: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']), | ||
labelOffset: _react.PropTypes.number, | ||
textAnchor: _react.PropTypes.string, | ||
labelClassName: _react.PropTypes.string | ||
}, | ||
enumerable: true | ||
}]); | ||
return Label; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Label; | ||
module.exports = exports['default']; | ||
Label.defaultProps = _extends({ | ||
hTransform: 'rotate(0)', | ||
vTransform: 'rotate(270)', | ||
labelTitle: 'label title', | ||
labelPosition: 'bottom', | ||
labelOffset: 40, | ||
textAnchor: 'middle', | ||
labelClassName: 'react-d3-core__label' | ||
}, _commonProps2.default); | ||
Label.propTypes = { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
hTransform: _react.PropTypes.string, | ||
vTransform: _react.PropTypes.string, | ||
labelTitle: _react.PropTypes.string, | ||
labelPosition: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']), | ||
labelOffset: _react.PropTypes.number, | ||
textAnchor: _react.PropTypes.string, | ||
labelClassName: _react.PropTypes.string | ||
}; | ||
exports.default = Label; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -33,3 +27,11 @@ | ||
var Xaxis = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Xaxis = function (_Component) { | ||
_inherits(Xaxis, _Component); | ||
@@ -40,3 +42,3 @@ | ||
_get(Object.getPrototypeOf(Xaxis.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Xaxis).call(this, props)); | ||
} | ||
@@ -70,2 +72,3 @@ | ||
var t; | ||
@@ -87,3 +90,3 @@ var axisLabel; | ||
if (xLabel) { | ||
axisLabel = _react2['default'].createElement(_label2['default'], { | ||
axisLabel = _react2.default.createElement(_label2.default, { | ||
height: height, | ||
@@ -99,6 +102,6 @@ width: width, | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'g', | ||
{ transform: t }, | ||
_react2['default'].createElement(_axis2['default'], { | ||
_react2.default.createElement(_axis2.default, { | ||
height: height, | ||
@@ -127,44 +130,37 @@ width: width, | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
showXAxis: true, | ||
xAxisClassName: 'react-d3-core__axis__xAxis', | ||
xScale: 'linear', | ||
xOrient: 'bottom', | ||
xTickOrient: 'bottom', | ||
xLabelPosition: 'bottom', | ||
xTickPadding: 3, | ||
xInnerTickSize: 6, | ||
xOuterTickSize: 6 | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
showXAxis: _react.PropTypes.bool, | ||
x: _react.PropTypes.func, | ||
xDomain: _react.PropTypes.array, | ||
xRange: _react.PropTypes.array, | ||
xScale: _react.PropTypes.string.isRequired, | ||
xOrient: _react.PropTypes.oneOf(['top', 'bottom']), | ||
xTickOrient: _react.PropTypes.oneOf(['top', 'bottom']), | ||
xAxisClassName: _react.PropTypes.string, | ||
xInnerTickSize: _react.PropTypes.number, | ||
xOuterTickSize: _react.PropTypes.number, | ||
xTickPadding: _react.PropTypes.number, | ||
xTickFormat: _react.PropTypes.func, | ||
xTicks: _react.PropTypes.array, | ||
style: _react.PropTypes.object | ||
}, | ||
enumerable: true | ||
}]); | ||
return Xaxis; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Xaxis; | ||
module.exports = exports['default']; | ||
Xaxis.defaultProps = _extends({ | ||
showXAxis: true, | ||
xAxisClassName: 'react-d3-core__axis__xAxis', | ||
xScale: 'linear', | ||
xOrient: 'bottom', | ||
xTickOrient: 'bottom', | ||
xLabelPosition: 'bottom', | ||
xTickPadding: 3, | ||
xInnerTickSize: 6, | ||
xOuterTickSize: 6 | ||
}, _commonProps2.default); | ||
Xaxis.propTypes = { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
showXAxis: _react.PropTypes.bool, | ||
x: _react.PropTypes.func, | ||
xDomain: _react.PropTypes.array, | ||
xRange: _react.PropTypes.array, | ||
xScale: _react.PropTypes.string.isRequired, | ||
xOrient: _react.PropTypes.oneOf(['top', 'bottom']), | ||
xTickOrient: _react.PropTypes.oneOf(['top', 'bottom']), | ||
xAxisClassName: _react.PropTypes.string, | ||
xInnerTickSize: _react.PropTypes.number, | ||
xOuterTickSize: _react.PropTypes.number, | ||
xTickPadding: _react.PropTypes.number, | ||
xTickFormat: _react.PropTypes.func, | ||
xTicks: _react.PropTypes.array, | ||
style: _react.PropTypes.object | ||
}; | ||
exports.default = Xaxis; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -33,3 +27,11 @@ | ||
var Yaxis = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Yaxis = function (_Component) { | ||
_inherits(Yaxis, _Component); | ||
@@ -40,3 +42,3 @@ | ||
_get(Object.getPrototypeOf(Yaxis.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Yaxis).call(this, props)); | ||
} | ||
@@ -70,2 +72,3 @@ | ||
var t; | ||
@@ -87,3 +90,3 @@ var axisLabel; | ||
if (yLabel) { | ||
axisLabel = _react2['default'].createElement(_label2['default'], { | ||
axisLabel = _react2.default.createElement(_label2.default, { | ||
height: height, | ||
@@ -98,6 +101,6 @@ width: width, | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'g', | ||
{ transform: t }, | ||
_react2['default'].createElement(_axis2['default'], { | ||
_react2.default.createElement(_axis2.default, { | ||
height: height, | ||
@@ -126,44 +129,37 @@ width: width, | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
showYAxis: true, | ||
yAxisClassName: 'react-d3-core__axis__yAxis', | ||
yScale: 'linear', | ||
yOrient: 'left', | ||
yTickOrient: 'left', | ||
yLabelPosition: 'left', | ||
yTickPadding: 3, | ||
yInnerTickSize: 6, | ||
yOuterTickSize: 6 | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
showXAxis: _react.PropTypes.bool, | ||
y: _react.PropTypes.func, | ||
yDomain: _react.PropTypes.array, | ||
yRange: _react.PropTypes.array, | ||
yScale: _react.PropTypes.string.isRequired, | ||
yOrient: _react.PropTypes.oneOf(['left', 'right']), | ||
yTickOrient: _react.PropTypes.oneOf(['left', 'right']), | ||
yAxisClassName: _react.PropTypes.string, | ||
yInnerTickSize: _react.PropTypes.number, | ||
yOuterTickSize: _react.PropTypes.number, | ||
yTickPadding: _react.PropTypes.number, | ||
yTickFormat: _react.PropTypes.func, | ||
yTicks: _react.PropTypes.array, | ||
style: _react.PropTypes.object | ||
}, | ||
enumerable: true | ||
}]); | ||
return Yaxis; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Yaxis; | ||
module.exports = exports['default']; | ||
Yaxis.defaultProps = _extends({ | ||
showYAxis: true, | ||
yAxisClassName: 'react-d3-core__axis__yAxis', | ||
yScale: 'linear', | ||
yOrient: 'left', | ||
yTickOrient: 'left', | ||
yLabelPosition: 'left', | ||
yTickPadding: 3, | ||
yInnerTickSize: 6, | ||
yOuterTickSize: 6 | ||
}, _commonProps2.default); | ||
Yaxis.propTypes = { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
showXAxis: _react.PropTypes.bool, | ||
y: _react.PropTypes.func, | ||
yDomain: _react.PropTypes.array, | ||
yRange: _react.PropTypes.array, | ||
yScale: _react.PropTypes.string.isRequired, | ||
yOrient: _react.PropTypes.oneOf(['left', 'right']), | ||
yTickOrient: _react.PropTypes.oneOf(['left', 'right']), | ||
yAxisClassName: _react.PropTypes.string, | ||
yInnerTickSize: _react.PropTypes.number, | ||
yOuterTickSize: _react.PropTypes.number, | ||
yTickPadding: _react.PropTypes.number, | ||
yTickFormat: _react.PropTypes.func, | ||
yTicks: _react.PropTypes.array, | ||
style: _react.PropTypes.object | ||
}; | ||
exports.default = Yaxis; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -9,12 +9,4 @@ }); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -24,5 +16,5 @@ | ||
var _containerSvg = require('./container/svg'); | ||
var _svg = require('./container/svg'); | ||
var _containerSvg2 = _interopRequireDefault(_containerSvg); | ||
var _svg2 = _interopRequireDefault(_svg); | ||
@@ -37,3 +29,11 @@ var _legend = require('./legend'); | ||
var ChartContainer = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var ChartContainer = function (_Component) { | ||
_inherits(ChartContainer, _Component); | ||
@@ -44,3 +44,3 @@ | ||
_get(Object.getPrototypeOf(ChartContainer.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(ChartContainer).call(this, props)); | ||
} | ||
@@ -55,2 +55,3 @@ | ||
var legend; | ||
@@ -63,3 +64,3 @@ | ||
if (chartSeries) { | ||
legend = _react2['default'].createElement(_legend2['default'], _extends({}, this.props, { | ||
legend = _react2.default.createElement(_legend2.default, _extends({}, this.props, { | ||
chartSeries: chartSeries | ||
@@ -69,19 +70,15 @@ })); | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: divStyle }, | ||
legend, | ||
_react2['default'].createElement(_containerSvg2['default'], this.props) | ||
_react2.default.createElement(_svg2.default, this.props) | ||
); | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: _commonProps2['default'], | ||
enumerable: true | ||
}]); | ||
return ChartContainer; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = ChartContainer; | ||
module.exports = exports['default']; | ||
ChartContainer.defaultProps = _commonProps2.default; | ||
exports.default = ChartContainer; |
@@ -6,7 +6,6 @@ "use strict"; | ||
}); | ||
exports["default"] = { | ||
exports.default = { | ||
width: 960, | ||
height: 500, | ||
margins: { top: 80, right: 100, bottom: 80, left: 100 } | ||
}; | ||
module.exports = exports["default"]; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -21,5 +15,5 @@ | ||
var _d3 = require('d3'); | ||
var _d = require('d3'); | ||
var _d32 = _interopRequireDefault(_d3); | ||
var _d2 = _interopRequireDefault(_d); | ||
@@ -30,5 +24,13 @@ var _commonProps = require('../commonProps'); | ||
var _utilsScale = require('../utils/scale'); | ||
var _scale = require('../utils/scale'); | ||
var ChartSvg = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var ChartSvg = function (_Component) { | ||
_inherits(ChartSvg, _Component); | ||
@@ -39,3 +41,3 @@ | ||
_get(Object.getPrototypeOf(ChartSvg.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(ChartSvg).call(this, props)); | ||
} | ||
@@ -54,5 +56,6 @@ | ||
var t = 'translate(' + margins.left + ', ' + margins.top + ')'; | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'svg', | ||
@@ -66,3 +69,3 @@ { | ||
}, | ||
_react2['default'].createElement( | ||
_react2.default.createElement( | ||
'g', | ||
@@ -76,26 +79,19 @@ { | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
svgClassName: 'react-d3-core__container_svg', | ||
onZoom: function onZoom() {}, | ||
scaleExtent: [1, 10] | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
id: _react.PropTypes.string, | ||
width: _react.PropTypes.number.isRequired, | ||
height: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
svgClassName: _react.PropTypes.string.isRequired | ||
}, | ||
enumerable: true | ||
}]); | ||
return ChartSvg; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = ChartSvg; | ||
module.exports = exports['default']; | ||
ChartSvg.defaultProps = _extends({ | ||
svgClassName: 'react-d3-core__container_svg', | ||
onZoom: function onZoom() {}, | ||
scaleExtent: [1, 10] | ||
}, _commonProps2.default); | ||
ChartSvg.propTypes = { | ||
id: _react.PropTypes.string, | ||
width: _react.PropTypes.number.isRequired, | ||
height: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
svgClassName: _react.PropTypes.string.isRequired | ||
}; | ||
exports.default = ChartSvg; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -25,3 +19,11 @@ | ||
var ChartTitle = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var ChartTitle = function (_Component) { | ||
_inherits(ChartTitle, _Component); | ||
@@ -32,3 +34,3 @@ | ||
_get(Object.getPrototypeOf(ChartTitle.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(ChartTitle).call(this, props)); | ||
} | ||
@@ -44,2 +46,3 @@ | ||
var titleStyle = { | ||
@@ -52,3 +55,3 @@ width: width, | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'div', | ||
@@ -62,23 +65,16 @@ { | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
titleClassName: 'react-d3-core__container_title', | ||
title: '' | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
width: _react.PropTypes.number.isRequired, | ||
title: _react.PropTypes.string, | ||
titleClassName: _react.PropTypes.string | ||
}, | ||
enumerable: true | ||
}]); | ||
return ChartTitle; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = ChartTitle; | ||
module.exports = exports['default']; | ||
ChartTitle.defaultProps = _extends({ | ||
titleClassName: 'react-d3-core__container_title', | ||
title: '' | ||
}, _commonProps2.default); | ||
ChartTitle.propTypes = { | ||
width: _react.PropTypes.number.isRequired, | ||
title: _react.PropTypes.string, | ||
titleClassName: _react.PropTypes.string | ||
}; | ||
exports.default = ChartTitle; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -21,5 +15,5 @@ | ||
var _axisAxis = require('../axis/axis'); | ||
var _axis = require('../axis/axis'); | ||
var _axisAxis2 = _interopRequireDefault(_axisAxis); | ||
var _axis2 = _interopRequireDefault(_axis); | ||
@@ -30,3 +24,11 @@ var _commonProps = require('../commonProps'); | ||
var Grid = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Grid = function (_Component) { | ||
_inherits(Grid, _Component); | ||
@@ -37,3 +39,3 @@ | ||
_get(Object.getPrototypeOf(Grid.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Grid).call(this, props)); | ||
} | ||
@@ -61,2 +63,3 @@ | ||
var gridAxis; | ||
@@ -78,3 +81,3 @@ var t; | ||
// if grid axis don't pass customize ticks. | ||
gridAxis = _react2['default'].createElement(_axisAxis2['default'], { | ||
gridAxis = _react2.default.createElement(_axis2.default, { | ||
height: height, | ||
@@ -103,3 +106,3 @@ width: width, | ||
// if grid axis don't pass customize ticks. | ||
gridAxis = _react2['default'].createElement(_axisAxis2['default'], { | ||
gridAxis = _react2.default.createElement(_axis2.default, { | ||
height: height, | ||
@@ -125,3 +128,3 @@ width: width, | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'g', | ||
@@ -132,35 +135,28 @@ { transform: t }, | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
type: 'x', | ||
gridAxisClassName: 'react-d3-core__grid_axis' | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
type: _react.PropTypes.oneOf(['x', 'y']).isRequired, | ||
gridAxisClassName: _react.PropTypes.string, | ||
x: _react.PropTypes.func, | ||
xDomain: _react.PropTypes.array, | ||
xRange: _react.PropTypes.array, | ||
xScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired, | ||
xRangeRoundBands: _react.PropTypes.object, | ||
y: _react.PropTypes.func, | ||
yDomain: _react.PropTypes.array, | ||
yRange: _react.PropTypes.array, | ||
yScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired, | ||
yRangeRoundBands: _react.PropTypes.object | ||
}, | ||
enumerable: true | ||
}]); | ||
return Grid; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Grid; | ||
module.exports = exports['default']; | ||
Grid.defaultProps = _extends({ | ||
type: 'x', | ||
gridAxisClassName: 'react-d3-core__grid_axis' | ||
}, _commonProps2.default); | ||
Grid.propTypes = { | ||
height: _react.PropTypes.number.isRequired, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
type: _react.PropTypes.oneOf(['x', 'y']).isRequired, | ||
gridAxisClassName: _react.PropTypes.string, | ||
x: _react.PropTypes.func, | ||
xDomain: _react.PropTypes.array, | ||
xRange: _react.PropTypes.array, | ||
xScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired, | ||
xRangeRoundBands: _react.PropTypes.object, | ||
y: _react.PropTypes.func, | ||
yDomain: _react.PropTypes.array, | ||
yRange: _react.PropTypes.array, | ||
yScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired, | ||
yRangeRoundBands: _react.PropTypes.object | ||
}; | ||
exports.default = Grid; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -9,12 +9,4 @@ }); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -28,3 +20,11 @@ | ||
var XGrid = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var XGrid = function (_Component) { | ||
_inherits(XGrid, _Component); | ||
@@ -35,3 +35,3 @@ | ||
_get(Object.getPrototypeOf(XGrid.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(XGrid).call(this, props)); | ||
} | ||
@@ -42,3 +42,3 @@ | ||
value: function render() { | ||
return _react2['default'].createElement(_grid2['default'], _extends({}, this.props, { | ||
return _react2.default.createElement(_grid2.default, _extends({}, this.props, { | ||
type: 'x' | ||
@@ -50,5 +50,4 @@ })); | ||
return XGrid; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = XGrid; | ||
module.exports = exports['default']; | ||
exports.default = XGrid; |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -9,12 +9,4 @@ }); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -28,3 +20,11 @@ | ||
var YGrid = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var YGrid = function (_Component) { | ||
_inherits(YGrid, _Component); | ||
@@ -35,3 +35,3 @@ | ||
_get(Object.getPrototypeOf(YGrid.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(YGrid).call(this, props)); | ||
} | ||
@@ -42,3 +42,3 @@ | ||
value: function render() { | ||
return _react2['default'].createElement(_grid2['default'], _extends({}, this.props, { | ||
return _react2.default.createElement(_grid2.default, _extends({}, this.props, { | ||
type: 'y' | ||
@@ -50,5 +50,4 @@ })); | ||
return YGrid; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = YGrid; | ||
module.exports = exports['default']; | ||
exports.default = YGrid; |
119
lib/index.js
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; } | ||
var _svg = require('./container/svg'); | ||
var _containerSvg = require('./container/svg'); | ||
Object.defineProperty(exports, 'Svg', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_svg).default; | ||
} | ||
}); | ||
exports.Svg = _interopRequire(_containerSvg); | ||
var _title = require('./container/title'); | ||
var _containerTitle = require('./container/title'); | ||
Object.defineProperty(exports, 'Title', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_title).default; | ||
} | ||
}); | ||
exports.Title = _interopRequire(_containerTitle); | ||
var _chartContainer = require('./chartContainer'); | ||
exports.Chart = _interopRequire(_chartContainer); | ||
Object.defineProperty(exports, 'Chart', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_chartContainer).default; | ||
} | ||
}); | ||
var _axisAxis = require('./axis/axis'); | ||
var _axis = require('./axis/axis'); | ||
exports.Axis = _interopRequire(_axisAxis); | ||
Object.defineProperty(exports, 'Axis', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_axis).default; | ||
} | ||
}); | ||
var _axisXaxis = require('./axis/xaxis'); | ||
var _xaxis = require('./axis/xaxis'); | ||
exports.Xaxis = _interopRequire(_axisXaxis); | ||
Object.defineProperty(exports, 'Xaxis', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_xaxis).default; | ||
} | ||
}); | ||
var _axisYaxis = require('./axis/yaxis'); | ||
var _yaxis = require('./axis/yaxis'); | ||
exports.Yaxis = _interopRequire(_axisYaxis); | ||
Object.defineProperty(exports, 'Yaxis', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_yaxis).default; | ||
} | ||
}); | ||
var _axisLabel = require('./axis/label'); | ||
var _label = require('./axis/label'); | ||
exports.Label = _interopRequire(_axisLabel); | ||
Object.defineProperty(exports, 'Label', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_label).default; | ||
} | ||
}); | ||
var _legend = require('./legend'); | ||
exports.Legend = _interopRequire(_legend); | ||
Object.defineProperty(exports, 'Legend', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_legend).default; | ||
} | ||
}); | ||
// grid | ||
var _grid = require('./grid/grid'); | ||
var _gridGrid = require('./grid/grid'); | ||
Object.defineProperty(exports, 'Grid', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_grid).default; | ||
} | ||
}); | ||
exports.Grid = _interopRequire(_gridGrid); | ||
var _xgrid = require('./grid/xgrid'); | ||
var _gridXgrid = require('./grid/xgrid'); | ||
Object.defineProperty(exports, 'Xgrid', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_xgrid).default; | ||
} | ||
}); | ||
exports.Xgrid = _interopRequire(_gridXgrid); | ||
var _ygrid = require('./grid/ygrid'); | ||
var _gridYgrid = require('./grid/ygrid'); | ||
Object.defineProperty(exports, 'Ygrid', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_ygrid).default; | ||
} | ||
}); | ||
exports.Ygrid = _interopRequire(_gridYgrid); | ||
var _scale = require('./utils/scale'); | ||
// utils | ||
var _utilsScale = require('./utils/scale'); | ||
Object.defineProperty(exports, 'scale', { | ||
enumerable: true, | ||
get: function get() { | ||
return _utilsScale.scale; | ||
return _scale.scale; | ||
} | ||
}); | ||
var _utilsXDomain = require('./utils/xDomain'); | ||
var _xDomain = require('./utils/xDomain'); | ||
@@ -71,7 +120,7 @@ Object.defineProperty(exports, 'xDomainCount', { | ||
get: function get() { | ||
return _utilsXDomain.xDomain; | ||
return _xDomain.xDomain; | ||
} | ||
}); | ||
var _utilsYDomain = require('./utils/yDomain'); | ||
var _yDomain = require('./utils/yDomain'); | ||
@@ -81,4 +130,6 @@ Object.defineProperty(exports, 'yDomainCount', { | ||
get: function get() { | ||
return _utilsYDomain.yDomain; | ||
return _yDomain.yDomain; | ||
} | ||
}); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
"use strict"; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _react = require('react'); | ||
@@ -21,5 +15,5 @@ | ||
var _d3 = require('d3'); | ||
var _d = require('d3'); | ||
var _d32 = _interopRequireDefault(_d3); | ||
var _d2 = _interopRequireDefault(_d); | ||
@@ -34,3 +28,11 @@ var _reactFauxDom = require('react-faux-dom'); | ||
var Legend = (function (_Component) { | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Legend = function (_Component) { | ||
_inherits(Legend, _Component); | ||
@@ -41,6 +43,11 @@ | ||
_get(Object.getPrototypeOf(Legend.prototype), 'constructor', this).call(this, props); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(Legend).call(this, props)); | ||
} | ||
_createClass(Legend, [{ | ||
key: '_radius', | ||
value: function _radius(swatchShape) { | ||
return swatchShape === 'circle' ? 18 : 0; | ||
} | ||
}, { | ||
key: '_series', | ||
@@ -51,20 +58,15 @@ value: function _series(props) { | ||
categoricalColors = categoricalColors || _d32['default'].scale.category10(); | ||
var series = chartSeries.map(function (f, i) { | ||
var colors = categoricalColors || _d2.default.scale.category10(); | ||
// set a color if not set | ||
f.color = f.color || categoricalColors(i); | ||
// set name if not set | ||
f.name = f.name || f.field; | ||
return chartSeries.map(function (_ref, i) { | ||
var name = _ref.name; | ||
var color = _ref.color; | ||
var field = _ref.field; | ||
return { | ||
color: f.color, | ||
name: f.name, | ||
field: f.field | ||
color: color || colors(i), | ||
name: name || field, | ||
field: field | ||
}; | ||
}); | ||
return series; | ||
} | ||
@@ -75,24 +77,24 @@ }, { | ||
var _props = this.props; | ||
var width = _props.width; | ||
var margins = _props.margins; | ||
var chartSeries = _props.chartSeries; | ||
var legendClassName = _props.legendClassName; | ||
var backgroundColor = _props.backgroundColor; | ||
var legendPosition = _props.legendPosition; | ||
var legendOffset = _props.legendOffset; | ||
var swatchShape = _props.swatchShape; | ||
var chartSeries = _props.chartSeries; | ||
var margins = _props.margins; | ||
var width = _props.width; | ||
var legendArea = _d32['default'].select(dom); | ||
var legendArea = _d2.default.select(dom); | ||
var series = this._series(this.props); | ||
var radius = this._radius(swatchShape); | ||
// make legends | ||
var legend = legendArea.selectAll('div').data(series).enter().append("div").attr("class", legendClassName + ' legend') | ||
// .style("width", 120) | ||
.style("height", 20).style("padding", 5).style("background-color", '#EEE').style("display", "inline-block"); | ||
var legend = legendArea.selectAll('div').data(series).enter().append("div").attr("class", legendClassName + ' legend').style("height", 20).style("padding", 5).style("background-color", backgroundColor).style("display", "inline-block"); | ||
var rect = legend.append("div").style("width", 18).style("height", 18).style("background-color", function (d) { | ||
var rect = legend.append("div").style("width", 18).style("height", 18).style("border-radius", radius).style("background-color", function (d) { | ||
return d.color; | ||
}).style("float", legendPosition); | ||
var text = legend.append("div") | ||
// .style("width", 92) | ||
.style("padding-left", 5).style("padding-right", 5).text(function (d) { | ||
var text = legend.append("div").style("padding-left", 5).style("padding-right", 5).text(function (d) { | ||
return d.name; | ||
@@ -111,3 +113,4 @@ }).style("float", legendPosition); | ||
var legendGroup = _reactFauxDom2['default'].createElement('div'); | ||
var legendGroup = _reactFauxDom2.default.createElement('div'); | ||
var legendClasses = legendClassName + ' legend'; | ||
@@ -119,32 +122,27 @@ | ||
var legendDom = this._mkLegend(legendGroup); | ||
return legendDom.node().toReact(); | ||
return this._mkLegend(legendGroup).node().toReact(); | ||
} | ||
}], [{ | ||
key: 'defaultProps', | ||
value: Object.assign(_commonProps2['default'], { | ||
legendHeight: 50, | ||
legendPosition: 'left', | ||
legendOffset: 90, | ||
legendClassName: 'react-d3-core__legend' | ||
}), | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
chartSeries: _react.PropTypes.array.isRequired, | ||
legendOffset: _react.PropTypes.number.isRequired, | ||
legendClassName: _react.PropTypes.string.isRequired, | ||
legendPosition: _react.PropTypes.oneOf(['left', 'right']).isRequired | ||
}, | ||
enumerable: true | ||
}]); | ||
return Legend; | ||
})(_react.Component); | ||
}(_react.Component); | ||
exports['default'] = Legend; | ||
module.exports = exports['default']; | ||
Legend.defaultProps = _extends({ | ||
backgroundColor: '#FFF', | ||
legendHeight: 50, | ||
legendPosition: 'left', | ||
legendOffset: 90, | ||
legendClassName: 'react-d3-core__legend', | ||
swatchShape: 'square' | ||
}, _commonProps2.default); | ||
Legend.propTypes = { | ||
backgroundColor: _react.PropTypes.string, | ||
width: _react.PropTypes.number.isRequired, | ||
margins: _react.PropTypes.object.isRequired, | ||
chartSeries: _react.PropTypes.array.isRequired, | ||
legendOffset: _react.PropTypes.number.isRequired, | ||
legendClassName: _react.PropTypes.string.isRequired, | ||
legendPosition: _react.PropTypes.oneOf(['left', 'right']).isRequired, | ||
swatchShape: _react.PropTypes.oneOf(['circle', 'square']) | ||
}; | ||
exports.default = Legend; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -8,7 +8,7 @@ }); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _d = require('d3'); | ||
var _d3 = require('d3'); | ||
var _d2 = _interopRequireDefault(_d); | ||
var _d32 = _interopRequireDefault(_d3); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -19,5 +19,6 @@ function scale(props) { | ||
var func; | ||
if (scale === 'linear') func = _d32['default'].scale.linear();else if (scale === 'identity') func = _d32['default'].scale.identity();else if (scale === 'sqrt') func = _d32['default'].scale.sqrt();else if (scale === 'pow') func = _d32['default'].scale.pow();else if (scale === 'log') func = _d32['default'].scale.log();else if (scale === 'quantize') func = _d32['default'].scale.quantize();else if (scale === 'quantile') func = _d32['default'].scale.quantile();else if (scale === 'ordinal') func = _d32['default'].scale.ordinal();else if (scale === 'time') func = _d32['default'].time.scale();else new Error('Please check your axis scale setting. "' + scale + '" scale is invalid. '); | ||
if (scale === 'linear') func = _d2.default.scale.linear();else if (scale === 'identity') func = _d2.default.scale.identity();else if (scale === 'sqrt') func = _d2.default.scale.sqrt();else if (scale === 'pow') func = _d2.default.scale.pow();else if (scale === 'log') func = _d2.default.scale.log();else if (scale === 'quantize') func = _d2.default.scale.quantize();else if (scale === 'quantile') func = _d2.default.scale.quantile();else if (scale === 'ordinal') func = _d2.default.scale.ordinal();else if (scale === 'time') func = _d2.default.time.scale();else new Error('Please check your axis scale setting. "' + scale + '" scale is invalid. '); | ||
@@ -36,2 +37,3 @@ func = _mkScaleSettings(props, func); | ||
if (range) func.range(range); | ||
@@ -46,2 +48,3 @@ | ||
if (padding && outerPadding) func.rangeRoundBands(interval, padding, outerPadding);else if (padding) func.rangeRoundBands(interval, padding);else func.rangeRoundBands(interval); | ||
@@ -48,0 +51,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -8,7 +8,7 @@ }); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _d = require('d3'); | ||
var _d3 = require('d3'); | ||
var _d2 = _interopRequireDefault(_d); | ||
var _d32 = _interopRequireDefault(_d3); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -22,2 +22,3 @@ function xDomain(props, stack, horizonal) { | ||
if (xDomain) return xDomain; | ||
@@ -31,3 +32,3 @@ | ||
} else { | ||
return _d32['default'].extent(data, function (d) { | ||
return _d2.default.extent(data, function (d) { | ||
return x(d); | ||
@@ -65,3 +66,3 @@ }); | ||
var field = d.field; | ||
var extent = _d32['default'].extent(data, function (dt) { | ||
var extent = _d2.default.extent(data, function (dt) { | ||
return x(dt[field]); | ||
@@ -73,5 +74,5 @@ }); | ||
return _d32['default'].extent([].concat.apply([], domainArr)); | ||
return _d2.default.extent([].concat.apply([], domainArr)); | ||
} | ||
} | ||
} |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
@@ -8,7 +8,7 @@ }); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _d = require('d3'); | ||
var _d3 = require('d3'); | ||
var _d2 = _interopRequireDefault(_d); | ||
var _d32 = _interopRequireDefault(_d3); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -19,5 +19,5 @@ function yDomain(props, stack, horizonal) { | ||
var y = props.y; | ||
var yScale = props.yScale; | ||
var yDomain = props.yDomain; | ||
if (yDomain) return yDomain; | ||
@@ -54,3 +54,3 @@ | ||
var field = d.field; | ||
var extent = _d32['default'].extent(data, function (dt) { | ||
var extent = _d2.default.extent(data, function (dt) { | ||
return y(dt[field]); | ||
@@ -62,3 +62,3 @@ }); | ||
return _d32['default'].extent([].concat.apply([], domainArr)); | ||
return _d2.default.extent([].concat.apply([], domainArr)); | ||
} | ||
@@ -71,3 +71,3 @@ } else { | ||
} else { | ||
return _d32['default'].extent(data, function (d) { | ||
return _d2.default.extent(data, function (d) { | ||
return y(d); | ||
@@ -74,0 +74,0 @@ }); |
{ | ||
"name": "react-d3-core", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "react-d3 chart core component", | ||
@@ -8,3 +8,4 @@ "main": "./lib/index.js", | ||
"test": "karma start", | ||
"build": "rm -rf ./lib && babel -w --stage 0 src --out-dir lib", | ||
"dev-server": "webpack-dev-server", | ||
"build": "rm -rf ./lib && ./node_modules/.bin/babel src --out-dir lib", | ||
"prod": "NODE_ENV=0 webpack --config webpack.prod.config.js && NODE_ENV=1 webpack --config webpack.prod.config.js" | ||
@@ -15,9 +16,11 @@ }, | ||
"devDependencies": { | ||
"babel-core": "^5.8.24", | ||
"babel-jest": "^5.3.0", | ||
"babel-loader": "^5.3.2", | ||
"css-loader": "^0.18.0", | ||
"babel-cli": "^6.5.1", | ||
"babel-jest": "^6.0.1", | ||
"babel-loader": "^6.2.3", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"dsv-loader": "^1.0.0", | ||
"expect": "^1.13.3", | ||
"json-loader": "^0.5.3", | ||
"json-loader": "^0.5.4", | ||
"jsx-loader": "^0.13.2", | ||
@@ -35,3 +38,4 @@ "karma": "^0.13.15", | ||
"webpack": "^1.12.2", | ||
"webpack-dev-server": "^1.11.0" | ||
"webpack-dev-server": "^1.11.0", | ||
"style-loader": "^0.12.4" | ||
}, | ||
@@ -43,5 +47,5 @@ "peerDependencies": { | ||
"d3": "^3.5.6", | ||
"react-dom": "^0.14.0", | ||
"react-faux-dom": "^2.0.1" | ||
"react-dom": "^0.14.7", | ||
"react-faux-dom": "^2.3.0" | ||
} | ||
} |
@@ -145,3 +145,3 @@ # react-d3-core | ||
$ npm install | ||
$ npm install -g babel@5.8.23 | ||
$ npm run dev-server | ||
$ npm run build | ||
@@ -148,0 +148,0 @@ $ webpack -w |
@@ -1,2 +0,1 @@ | ||
'use strict'; | ||
@@ -13,6 +12,5 @@ | ||
module.exports = [{ | ||
name: 'react-d3-core-example-es5', | ||
devtool: ENV ? "source-map": '', | ||
devtool: ENV ? "source-map" : '', | ||
entry: { | ||
@@ -30,17 +28,17 @@ xaxis: './example/src/xaxis.jsx', | ||
path: path.join(__dirname, './example/dist'), | ||
filename: ENV ? '[name].min.js': '[name].js' | ||
filename: ENV ? '[name].min.js' : '[name].js' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: [/\.jsx$/, /\.js$/], | ||
exclude: /node_modules/, | ||
loaders: ["jsx-loader"], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: 'style-loader!css-loader' | ||
loaders: [{ | ||
loader: 'babel-loader', | ||
test: [/\.jsx$/, /\.js$/], | ||
exclude: /node_modules/, | ||
query: { | ||
presets: ['react', 'es2015', 'stage-0'] | ||
} | ||
], | ||
}, { | ||
test: /\.css$/, | ||
loader: 'style-loader!css-loader' | ||
}], | ||
}, | ||
@@ -53,5 +51,7 @@ | ||
plugins: ENV ? [ | ||
new webpack.optimize.UglifyJsPlugin({minimize: true}) | ||
]:[] | ||
new webpack.optimize.UglifyJsPlugin({ | ||
minimize: true | ||
}) | ||
] : [] | ||
}]; |
'use strict'; | ||
var path = require('path'), | ||
webpack = require('webpack'), | ||
var path = require('path'), | ||
webpack = require('webpack'), | ||
nodeModulesPath = path.join(__dirname, 'node_modules'); | ||
@@ -25,17 +25,17 @@ | ||
path: js_dist, | ||
filename: ENV ? '[name].min.js': '[name].js' | ||
filename: ENV ? '[name].min.js' : '[name].js' | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: [/\.jsx$/, /\.js$/], | ||
exclude: /node_modules/, | ||
loaders: ["jsx-loader"], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: 'style-loader!css-loader' | ||
loaders: [{ | ||
loader: 'babel-loader', | ||
test: [/\.jsx$/, /\.js$/], | ||
exclude: /node_modules/, | ||
query: { | ||
presets: ['react', 'es2015', 'stage-0'] | ||
} | ||
], | ||
}, { | ||
test: /\.css$/, | ||
loader: 'style-loader!css-loader' | ||
}], | ||
}, | ||
@@ -63,3 +63,3 @@ | ||
}) | ||
]: [ | ||
] : [ | ||
new webpack.ProvidePlugin({ | ||
@@ -66,0 +66,0 @@ 'd3': 'd3' |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
65065
22
24
1327
1
Updatedreact-dom@^0.14.7
Updatedreact-faux-dom@^2.3.0