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

react-d3-basic

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-d3-basic - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

lib/commonProps.js

23

lib/area_stack.js

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -38,2 +38,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var AreaStackChart = (function (_xyChart) {

@@ -58,2 +62,5 @@ _inherits(AreaStackChart, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain(true);
var xScaleSet = this.mkXScale();

@@ -64,7 +71,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props, { xDomain: xDomain }));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props, { yDomain: yDomain }));
}

@@ -79,4 +86,2 @@

null,
xgrid,
ygrid,
_react2['default'].createElement(

@@ -87,4 +92,6 @@ 'g',

),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
xgrid,
ygrid,
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({}, this.props, { xDomain: xDomain })),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({}, this.props, { yDomain: yDomain }))
);

@@ -94,3 +101,3 @@ }

key: 'defaultProps',
value: {},
value: _commonProps2['default'],
enumerable: true

@@ -97,0 +104,0 @@ }]);

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -34,2 +34,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var BarGroupChart = (function (_xyChart) {

@@ -54,2 +58,5 @@ _inherits(BarGroupChart, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain();
var xScaleSet = this.mkXScale();

@@ -60,7 +67,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', xDomain: xDomain }, this.props));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', yDomain: yDomain }, this.props));
}

@@ -104,4 +111,4 @@

),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({ xDomain: xDomain }, this.props)),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({ yDomain: yDomain }, this.props))
);

@@ -111,6 +118,6 @@ }

key: 'defaultProps',
value: {
value: Object.assign(_commonProps2['default'], {
onMouseOver: function onMouseOver() {},
onMouseOut: function onMouseOut() {}
},
}),
enumerable: true

@@ -117,0 +124,0 @@ }]);

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -34,2 +34,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var BarStackChart = (function (_xyChart) {

@@ -52,2 +56,5 @@ _inherits(BarStackChart, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain(true);
var xScaleSet = this.mkXScale();

@@ -58,7 +65,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', key: 'xgrid', xDomain: xDomain }, this.props));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', key: 'ygrid', yDomain: yDomain }, this.props));
}

@@ -80,4 +87,4 @@

),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({ xDomain: xDomain }, this.props)),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({ yDomain: yDomain }, this.props))
);

@@ -87,7 +94,6 @@ }

key: 'defaultProps',
value: {
showLegend: true,
value: Object.assign(_commonProps2['default'], {
onMouseOver: function onMouseOver() {},
onMouseOut: function onMouseOut() {}
},
}),
enumerable: true

@@ -94,0 +100,0 @@ }]);

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -34,2 +34,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var BarChart = (function (_xyChart) {

@@ -54,2 +58,5 @@ _inherits(BarChart, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain();
var xScaleSet = this.mkXScale();

@@ -60,7 +67,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', key: 'xgrid', xDomain: xDomain }, this.props));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', key: 'ygrid', yDomain: yDomain }, this.props));
}

@@ -84,4 +91,4 @@

),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({ xDomain: xDomain }, this.props)),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({ yDomain: yDomain }, this.props))
);

@@ -91,6 +98,6 @@ }

key: 'defaultProps',
value: {
value: Object.assign(_commonProps2['default'], {
onMouseOver: function onMouseOver() {},
onMouseOut: function onMouseOut() {}
},
}),
enumerable: true

@@ -97,0 +104,0 @@ }]);

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -22,6 +22,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _reactAddonsCssTransitionGroup = require('react-addons-css-transition-group');
var _reactAddonsCssTransitionGroup2 = _interopRequireDefault(_reactAddonsCssTransitionGroup);
var _d3 = require('d3');

@@ -99,3 +95,2 @@

interpolate: null,
duration: 500,
lineClassName: 'react-d3-basic__line'

@@ -102,0 +97,0 @@ },

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -12,0 +12,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -60,2 +60,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

}
}], [{
key: "propTypes",
value: {
title: _react.PropTypes.string,
data: _react.PropTypes.array.isRequired,
chartSeries: _react.PropTypes.array.isRequired,
name: _react.PropTypes.func.isRequired,
value: _react.PropTypes.func.isRequired,
width: _react.PropTypes.number,
height: _react.PropTypes.number,
id: _react.PropTypes.string,
margins: _react.PropTypes.object,
svgClassName: _react.PropTypes.string,
titleClassName: _react.PropTypes.string,
categoricalColors: _react.PropTypes.func,
radius: _react.PropTypes.number,
outerRadius: _react.PropTypes.number,
innerRadius: _react.PropTypes.number,
pieSort: _react.PropTypes.func
},
enumerable: true
}]);

@@ -62,0 +83,0 @@

@@ -9,3 +9,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -42,5 +42,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var xRange = _props.xRange;
var xDomain = _props.xDomain;
var xRangeRoundBands = _props.xRangeRoundBands;
var xDomain = this.props.xDomain || this.setXDomain;
var newXScale = {

@@ -62,5 +63,6 @@ scale: xScale,

var yRange = _props2.yRange;
var yDomain = _props2.yDomain;
var yRangeRoundBands = _props2.yRangeRoundBands;
var yDomain = this.props.yDomain || this.setYDomain;
var newYScale = {

@@ -80,14 +82,67 @@ scale: yScale,

}
}, {
key: 'mkXDomain',
value: function mkXDomain() {
var _props3 = this.props;
var data = _props3.data;
var x = _props3.x;
var xScale = _props3.xScale;
if (xScale === 'ordinal') {
return this.setXDomain = data.map(function (d) {
return x(d);
});
} else {
return this.setXDomain = d3.extent(data, function (d) {
return x(d);
});
}
}
}, {
key: 'mkYDomain',
value: function mkYDomain(stack) {
var _props4 = this.props;
var data = _props4.data;
var chartSeries = _props4.chartSeries;
var y = _props4.y;
if (stack) {
// stack
var max = 0;
var min = 0;
data.forEach(function (d) {
var totalTop = 0;
var totalBottom = 0;
chartSeries.forEach(function (sd) {
var field = sd.field;
if (d[field] > 0) {
totalTop += y(d[field]);
} else if (d[field] < 0) {
totalBottom += y(d[field]);
}
});
if (totalTop > max) max = totalTop;
if (totalBottom < min) min = totalBottom;
});
return this.setYDomain = [min, max];
} else {
// not stack, single
var domainArr = chartSeries.map(function (d) {
var field = d.field;
var extent = d3.extent(data, function (dt) {
return y(dt[field]);
});
return extent;
});
return this.setYDomain = d3.extent([].concat.apply([], domainArr));
}
}
}], [{
key: 'defaultProps',
value: {
showLegend: true,
showXGrid: true,
showYGrid: true,
showXAxis: true,
showYAxis: true,
categoricalColors: d3.scale.category10()
},
enumerable: true
}, {
key: 'propTypes',

@@ -97,6 +152,7 @@ value: {

data: _react.PropTypes.array.isRequired,
width: _react.PropTypes.number.isRequired,
height: _react.PropTypes.number.isRequired,
chartSeries: _react.PropTypes.array.isRequired,
width: _react.PropTypes.number,
height: _react.PropTypes.number,
id: _react.PropTypes.string,
margins: _react.PropTypes.object.isRequired,
margins: _react.PropTypes.object,
svgClassName: _react.PropTypes.string,

@@ -106,16 +162,13 @@ titleClassName: _react.PropTypes.string,

xAxisClassName: _react.PropTypes.string,
legendClassName: _react.PropTypes.string,
lineClass: _react.PropTypes.string,
scatterClass: _react.PropTypes.string,
showScatter: _react.PropTypes.bool,
showLegend: _react.PropTypes.bool,
showXAxis: _react.PropTypes.bool,
showYAxis: _react.PropTypes.bool,
lineMulti: _react.PropTypes.array,
categoricalColors: _react.PropTypes.func,
interpolate: _react.PropTypes.string,
legendPosition: _react.PropTypes.oneOf(['left', 'right']),
x: _react.PropTypes.func.isRequired,
xDomain: _react.PropTypes.array,
xRange: _react.PropTypes.array,
xScale: _react.PropTypes.string.isRequired,
xScale: _react.PropTypes.string,
xOrient: _react.PropTypes.oneOf(['bottom', 'top']),

@@ -128,3 +181,3 @@ xTickOrient: _react.PropTypes.oneOf(['bottom', 'top']),

yRange: _react.PropTypes.array,
yScale: _react.PropTypes.string.isRequired,
yScale: _react.PropTypes.string,
yOrient: _react.PropTypes.oneOf(['right', 'left']),

@@ -131,0 +184,0 @@ yTickOrient: _react.PropTypes.oneOf(['right', 'left']),

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -24,6 +24,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _reactAddonsCssTransitionGroup = require('react-addons-css-transition-group');
var _reactAddonsCssTransitionGroup2 = _interopRequireDefault(_reactAddonsCssTransitionGroup);
var _d3 = require('d3');

@@ -51,2 +47,6 @@

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var LineChart = (function (_xyChart) {

@@ -76,2 +76,5 @@ _inherits(LineChart, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain();
var xScaleSet = this.mkXScale();

@@ -82,7 +85,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', key: 'xgrid' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', key: 'xgrid', xDomain: xDomain }, this.props));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', key: 'ygrid' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', key: 'ygrid', yDomain: yDomain }, this.props));
}

@@ -112,21 +115,12 @@

null,
xgrid,
ygrid,
_react2['default'].createElement(
'g',
{ ref: 'plotGroup' },
_react2['default'].createElement(
_reactAddonsCssTransitionGroup2['default'],
{
transitionName: 'default',
component: 'g',
transitionEnterTimeout: 1000,
transitionLeaveTimeout: 1000
},
lines
),
lines,
scatters
),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
xgrid,
ygrid,
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({ xDomain: xDomain }, this.props)),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({ yDomain: yDomain }, this.props))
);

@@ -136,5 +130,5 @@ }

key: 'defaultProps',
value: {
value: Object.assign(_commonProps2['default'], {
showScatter: false
},
}),
enumerable: true

@@ -141,0 +135,0 @@ }]);

@@ -11,8 +11,6 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; 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 _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError('Cannot destructure undefined'); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

@@ -36,2 +34,4 @@

var _commonProps = require('./commonProps');
var PieChart = (function (_PieLayout) {

@@ -49,7 +49,9 @@ _inherits(PieChart, _PieLayout);

value: function render() {
_objectDestructuringEmpty(this.props);
var _props = this.props;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var chartSeriesData = this._mkSeries();
var pie = _react2['default'].createElement(_componentsPie2['default'], _extends({ chartSeriesData: chartSeriesData }, this.props, { onMouseOver: this.props.onMouseOver, onMouseOut: this.props.onMouseOut }));
var pie = _react2['default'].createElement(_componentsPie2['default'], _extends({ chartSeriesData: chartSeriesData }, this.props, { onMouseOver: onMouseOver, onMouseOut: onMouseOut }));

@@ -64,6 +66,6 @@ return _react2['default'].createElement(

key: 'defaultProps',
value: {
value: Object.assign(_commonProps.pieProps, {
onMouseOver: function onMouseOver() {},
onMouseOut: function onMouseOut() {}
},
}),
enumerable: true

@@ -70,0 +72,0 @@ }]);

@@ -11,3 +11,3 @@ "use strict";

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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _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; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -34,2 +34,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _commonProps = require('./commonProps');
var _commonProps2 = _interopRequireDefault(_commonProps);
var ScatterPlot = (function (_xyChart) {

@@ -57,2 +61,5 @@ _inherits(ScatterPlot, _xyChart);

var xDomain = this.props.xDomain || this.mkXDomain();
var yDomain = this.props.yDomain || this.mkYDomain();
var xScaleSet = this.mkXScale();

@@ -63,7 +70,7 @@ var yScaleSet = this.mkYScale();

if (showXGrid) {
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x' }, this.props));
var xgrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'x', xDomain: xDomain }, this.props));
}
if (showYGrid) {
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y' }, this.props));
var ygrid = _react2['default'].createElement(_reactD3Core.Grid, _extends({ type: 'y', yDomain: yDomain }, this.props));
}

@@ -87,6 +94,10 @@

),
_react2['default'].createElement(_reactD3Core.Xaxis, this.props),
_react2['default'].createElement(_reactD3Core.Yaxis, this.props)
_react2['default'].createElement(_reactD3Core.Xaxis, _extends({ xDomain: xDomain }, this.props)),
_react2['default'].createElement(_reactD3Core.Yaxis, _extends({ yDomain: yDomain }, this.props))
);
}
}], [{
key: 'defaultProps',
value: _commonProps2['default'],
enumerable: true
}]);

@@ -93,0 +104,0 @@

{
"name": "react-d3-basic",
"version": "0.7.1",
"version": "0.8.0",
"description": "react chart component",

@@ -35,3 +35,3 @@ "main": "./lib/index.js",

"react-addons-css-transition-group": "^0.14.1",
"react-d3-core": "^0.5.2",
"react-d3-core": "^0.5.4",
"react-dom": "^0.14.0",

@@ -38,0 +38,0 @@ "react-faux-dom": "^2.0.1"

@@ -18,38 +18,3 @@ # react-d3-basic

## Docs
#### Charts
- [Line Chart](./docs/charts/line_chart.md)
- [Line Multiple Chart](./docs/charts/line_mult_chart.md)
- [Scatter Chart](./docs/charts/scatter_chart.md)
- [Area Chart](./docs/charts/area_chart.md)
- [Area Stack Chart](./docs/charts/area_stack_chart.md)
- [Bar Chart](./docs/charts/bar_chart.md)
- [Bar Group Chart](./docs/charts/bar_group_chart.md)
- [Bar Stack Chart](./docs/charts/bar_stack_chart.md)
- [Pie Chart](./docs/charts/pie_chart.md)
- [Donut Chart](./docs/charts/donut_chart.md)
#### Shape Components
- [Line](./docs/components/line.md)
- [Scatter](./docs/components/scatter.md)
- [Area](./docs/components/area.md)
- [Area Stack](./docs/components/area_stack.md)
- [Bar](./docs/components/bar.md)
- [Bar Group](./docs/components/bar_group.md)
- [Bar Stack](./docs/components/bar_stack.md)
- [Pie](./docs/components/pie.md)
#### Inherit
- [PieLayout](./docs/inherit/pie.md)
- [XYPlot](./docs/inherit/xyplot.md)
#### Utilities
- [Series](./docs/utils/series.md)
## Install

@@ -103,2 +68,6 @@

#### Utilities
- [Series](./docs/utils/series.md)
## Gallery

@@ -105,0 +74,0 @@

@@ -28,6 +28,9 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class AreaStackChart extends xyChart {
static defaultProps = {
}
static defaultProps = CommonProps

@@ -44,2 +47,5 @@ render() {

const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain(true);
const xScaleSet = this.mkXScale();

@@ -50,7 +56,7 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" {...this.props}/>
var xgrid = <Grid type="x" {...this.props} xDomain={xDomain}/>
}
if(showYGrid) {
var ygrid = <Grid type="y" {...this.props}/>
var ygrid = <Grid type="y" {...this.props} yDomain={yDomain}/>
}

@@ -64,9 +70,9 @@

<g>
{xgrid}
{ygrid}
<g ref= "plotGroup">
{areas}
</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
{xgrid}
{ygrid}
<Xaxis {...this.props} xDomain={xDomain} />
<Yaxis {...this.props} yDomain={yDomain} />
</g>

@@ -73,0 +79,0 @@ )

@@ -24,8 +24,12 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class BarGroupChart extends xyChart {
static defaultProps = {
static defaultProps = Object.assign(CommonProps, {
onMouseOver: () => {},
onMouseOut: () => {}
}
})

@@ -40,2 +44,5 @@ render() {

const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain();
const xScaleSet = this.mkXScale();

@@ -46,7 +53,7 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" {...this.props} />
var xgrid = <Grid type="x" xDomain={xDomain} {...this.props} />
}
if(showYGrid) {
var ygrid = <Grid type="y" {...this.props} />
var ygrid = <Grid type="y" yDomain={yDomain} {...this.props} />
}

@@ -88,4 +95,4 @@

</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
<Xaxis xDomain={xDomain} {...this.props} />
<Yaxis yDomain={yDomain} {...this.props} />
</g>

@@ -92,0 +99,0 @@ )

@@ -24,9 +24,12 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class BarStackChart extends xyChart {
static defaultProps = {
showLegend: true,
static defaultProps = Object.assign(CommonProps, {
onMouseOver: () => {},
onMouseOut: () => {}
}
})

@@ -41,2 +44,5 @@ render() {

const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain(true);
const xScaleSet = this.mkXScale();

@@ -47,7 +53,7 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" {...this.props} />
var xgrid = <Grid type="x" key="xgrid" xDomain={xDomain} {...this.props} />
}
if(showYGrid) {
var ygrid = <Grid type="y" {...this.props} />
var ygrid = <Grid type="y" key="ygrid" yDomain={yDomain} {...this.props} />
}

@@ -66,4 +72,4 @@

</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
<Xaxis xDomain={xDomain} {...this.props} />
<Yaxis yDomain={yDomain} {...this.props} />
</g>

@@ -70,0 +76,0 @@ )

@@ -24,9 +24,12 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class BarChart extends xyChart {
static defaultProps = {
static defaultProps = Object.assign(CommonProps, {
onMouseOver: () => {},
onMouseOut: () => {}
}
})

@@ -41,2 +44,5 @@ render() {

const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain();
const xScaleSet = this.mkXScale();

@@ -47,7 +53,7 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" {...this.props} />
var xgrid = <Grid type="x" key="xgrid" xDomain={xDomain} {...this.props} />
}
if(showYGrid) {
var ygrid = <Grid type="y" {...this.props} />
var ygrid = <Grid type="y" key="ygrid" yDomain={yDomain} {...this.props} />
}

@@ -68,4 +74,4 @@

</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
<Xaxis xDomain={xDomain} {...this.props} />
<Yaxis yDomain={yDomain} {...this.props} />
</g>

@@ -72,0 +78,0 @@ )

@@ -5,3 +5,4 @@ "use strict";

default as React,
Component
Component,
PropTypes,
} from 'react';

@@ -14,2 +15,21 @@

static propTypes = {
title: PropTypes.string,
data: PropTypes.array.isRequired,
chartSeries: PropTypes.array.isRequired,
name: PropTypes.func.isRequired,
value: PropTypes.func.isRequired,
width: PropTypes.number,
height: PropTypes.number,
id: PropTypes.string,
margins: PropTypes.object,
svgClassName: PropTypes.string,
titleClassName: PropTypes.string,
categoricalColors: PropTypes.func,
radius: PropTypes.number,
outerRadius: PropTypes.number,
innerRadius: PropTypes.number,
pieSort: PropTypes.func
}
_mkSeries() {

@@ -16,0 +36,0 @@ const {

@@ -22,10 +22,2 @@ "use strict";

static defaultProps = {
showXGrid: true,
showYGrid: true,
showXAxis: true,
showYAxis: true,
categoricalColors: d3.scale.category10(),
}
static propTypes = {

@@ -43,3 +35,2 @@ title: PropTypes.string,

xAxisClassName: PropTypes.string,
legendClassName: PropTypes.string,
lineClass: PropTypes.string,

@@ -50,2 +41,3 @@ scatterClass: PropTypes.string,

showYAxis: PropTypes.bool,
categoricalColors: PropTypes.func,
interpolate: PropTypes.string,

@@ -75,6 +67,7 @@ x: PropTypes.func.isRequired,

xRange,
xDomain,
xRangeRoundBands,
} = this.props;
const xDomain = this.props.xDomain || this.setXDomain;
var newXScale = {

@@ -95,6 +88,7 @@ scale: xScale,

yRange,
yDomain,
yRangeRoundBands,
} = this.props;
const yDomain = this.props.yDomain || this.setYDomain;
var newYScale = {

@@ -113,2 +107,60 @@ scale: yScale,

}
mkXDomain() {
const {
data,
x,
xScale
} = this.props;
if(xScale === 'ordinal') {
return this.setXDomain = data.map((d) => { return x(d); });
}else {
return this.setXDomain = d3.extent(data, (d) => { return x(d); });
}
}
mkYDomain(stack) {
const {
data,
chartSeries,
y
} = this.props;
if(stack) {
// stack
var max = 0;
var min = 0;
data.forEach((d) => {
var totalTop = 0;
var totalBottom = 0;
chartSeries.forEach((sd) => {
var field = sd.field;
if(d[field] > 0) {
totalTop += y(d[field]);
}else if (d[field] < 0) {
totalBottom += y(d[field]);
}
})
if(totalTop > max) max = totalTop;
if(totalBottom < min) min = totalBottom;
})
return this.setYDomain = [min, max];
}else {
// not stack, single
var domainArr = chartSeries.map((d) => {
var field = d.field;
var extent = d3.extent(data, (dt) => { return y(dt[field]); });
return extent;
})
return this.setYDomain = d3.extent([].concat.apply([], domainArr));
}
}
}

@@ -36,7 +36,11 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class LineChart extends xyChart {
static defaultProps = {
static defaultProps = Object.assign(CommonProps, {
showScatter: false
}
})

@@ -53,5 +57,8 @@ render() {

interpolate,
chartSeries,
chartSeries
} = this.props;
const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain();
const xScaleSet = this.mkXScale();

@@ -61,8 +68,9 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" key="xgrid" {...this.props} />
var xgrid = <Grid type="x" key="xgrid" xDomain={xDomain} {...this.props} />
}
if(showYGrid) {
var ygrid = <Grid type="y" key="ygrid" {...this.props} />
var ygrid = <Grid type="y" key="ygrid" yDomain={yDomain} {...this.props} />
}

@@ -91,4 +99,2 @@

<g>
{xgrid}
{ygrid}
<g ref= "plotGroup">

@@ -98,4 +104,6 @@ {lines}

</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
{xgrid}
{ygrid}
<Xaxis xDomain={xDomain} {...this.props} />
<Yaxis yDomain={yDomain} {...this.props} />
</g>

@@ -102,0 +110,0 @@ )

@@ -21,2 +21,7 @@ "use strict";

import {
pieProps
} from './commonProps';
export default class PieChart extends PieLayout {

@@ -27,9 +32,11 @@ constructor(props) {

static defaultProps = {
static defaultProps = Object.assign(pieProps, {
onMouseOver: () => {},
onMouseOut: () => {}
}
})
render() {
const {
onMouseOut,
onMouseOver
} = this.props;

@@ -39,3 +46,3 @@

var pie = <Pie chartSeriesData= {chartSeriesData} {...this.props} onMouseOver={this.props.onMouseOver} onMouseOut={this.props.onMouseOut}/>
var pie = <Pie chartSeriesData= {chartSeriesData} {...this.props} onMouseOver={onMouseOver} onMouseOut={onMouseOut}/>

@@ -42,0 +49,0 @@ return (

@@ -24,4 +24,10 @@ "use strict";

import {
default as CommonProps,
} from './commonProps';
export default class ScatterPlot extends xyChart {
static defaultProps = CommonProps
render() {

@@ -38,2 +44,6 @@

const xDomain = this.props.xDomain || this.mkXDomain();
const yDomain = this.props.yDomain || this.mkYDomain();
const xScaleSet = this.mkXScale();

@@ -44,7 +54,7 @@ const yScaleSet = this.mkYScale();

if(showXGrid) {
var xgrid = <Grid type="x" {...this.props} />
var xgrid = <Grid type="x" xDomain={xDomain} {...this.props} />
}
if(showYGrid) {
var ygrid = <Grid type="y" {...this.props} />
var ygrid = <Grid type="y" yDomain={yDomain} {...this.props} />
}

@@ -65,4 +75,4 @@

</g>
<Xaxis {...this.props} />
<Yaxis {...this.props} />
<Xaxis xDomain={xDomain} {...this.props} />
<Yaxis yDomain={yDomain} {...this.props} />
</g>

@@ -69,0 +79,0 @@ )

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