@nivo/chord
Advanced tools
Comparing version
@@ -13,2 +13,3 @@ 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; }; | ||
import { Container, SvgWrapper } from '@nivo/core'; | ||
import { BoxLegendSvg } from '@nivo/legends'; | ||
import enhance from './enhance'; | ||
@@ -50,3 +51,4 @@ import setDisplayName from 'recompose/setDisplayName'; | ||
getArcOpacity = _ref.getArcOpacity, | ||
getRibbonOpacity = _ref.getRibbonOpacity; | ||
getRibbonOpacity = _ref.getRibbonOpacity, | ||
legends = _ref.legends; | ||
@@ -62,2 +64,9 @@ var centerX = width / 2; | ||
var legendData = arcs.map(function (arc) { | ||
return { | ||
label: arc.id, | ||
fill: arc.color | ||
}; | ||
}); | ||
return React.createElement( | ||
@@ -108,3 +117,12 @@ Container, | ||
}, motionProps)) | ||
) | ||
), | ||
legends.map(function (legend, i) { | ||
return React.createElement(BoxLegendSvg, _extends({ | ||
key: i | ||
}, legend, { | ||
containerWidth: width, | ||
containerHeight: height, | ||
data: legendData | ||
})); | ||
}) | ||
); | ||
@@ -111,0 +129,0 @@ } |
@@ -10,2 +10,3 @@ /* | ||
import PropTypes from 'prop-types'; | ||
import { LegendPropShape } from '@nivo/legends'; | ||
@@ -53,3 +54,5 @@ export var ChordPropTypes = { | ||
// canvas specific | ||
pixelRatio: PropTypes.number.isRequired | ||
pixelRatio: PropTypes.number.isRequired, | ||
legends: PropTypes.arrayOf(PropTypes.shape(LegendPropShape)).isRequired | ||
}; | ||
@@ -90,3 +93,5 @@ | ||
// canvas specific | ||
pixelRatio: global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1 | ||
pixelRatio: global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1, | ||
legends: [] | ||
}; |
@@ -21,2 +21,4 @@ 'use strict'; | ||
var _legends = require('@nivo/legends'); | ||
var _enhance = require('./enhance'); | ||
@@ -75,3 +77,4 @@ | ||
getArcOpacity = _ref.getArcOpacity, | ||
getRibbonOpacity = _ref.getRibbonOpacity; | ||
getRibbonOpacity = _ref.getRibbonOpacity, | ||
legends = _ref.legends; | ||
@@ -87,2 +90,9 @@ var centerX = width / 2; | ||
var legendData = arcs.map(function (arc) { | ||
return { | ||
label: arc.id, | ||
fill: arc.color | ||
}; | ||
}); | ||
return _react2.default.createElement( | ||
@@ -133,3 +143,12 @@ _core.Container, | ||
}, motionProps)) | ||
) | ||
), | ||
legends.map(function (legend, i) { | ||
return _react2.default.createElement(_legends.BoxLegendSvg, _extends({ | ||
key: i | ||
}, legend, { | ||
containerWidth: width, | ||
containerHeight: height, | ||
data: legendData | ||
})); | ||
}) | ||
); | ||
@@ -136,0 +155,0 @@ } |
@@ -10,4 +10,14 @@ 'use strict'; | ||
var _legends = require('@nivo/legends'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* Copyright 2016-present, Raphaël Benitte. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
var ChordPropTypes = exports.ChordPropTypes = { | ||
@@ -54,11 +64,7 @@ matrix: _propTypes2.default.arrayOf(_propTypes2.default.arrayOf(_propTypes2.default.number)).isRequired, | ||
// canvas specific | ||
pixelRatio: _propTypes2.default.number.isRequired | ||
}; /* | ||
* This file is part of the nivo project. | ||
* | ||
* Copyright 2016-present, Raphaël Benitte. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
pixelRatio: _propTypes2.default.number.isRequired, | ||
legends: _propTypes2.default.arrayOf(_propTypes2.default.shape(_legends.LegendPropShape)).isRequired | ||
}; | ||
var ChordDefaultProps = exports.ChordDefaultProps = { | ||
@@ -97,3 +103,5 @@ padAngle: 0, | ||
// canvas specific | ||
pixelRatio: global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1 | ||
pixelRatio: global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1, | ||
legends: [] | ||
}; |
{ | ||
"name": "@nivo/chord", | ||
"version": "0.33.0-2", | ||
"version": "0.33.0-3", | ||
"license": "MIT", | ||
@@ -10,2 +10,3 @@ "main": "./lib/index.js", | ||
"@nivo/core": "0.32.0", | ||
"@nivo/legends": "0.33.0-3", | ||
"d3-chord": "^1.0.4", | ||
@@ -12,0 +13,0 @@ "d3-format": "^1.2.0", |
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
215578
0.71%2090
2%0
-100%9
12.5%+ Added