victory-line
Advanced tools
Comparing version 33.0.1 to 33.0.5
@@ -52,4 +52,5 @@ import _assign from "lodash/assign"; | ||
var openCurve = props.openCurve === undefined ? defaultOpenCurve : props.openCurve; | ||
var interpolation = !openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation); | ||
return polar ? d3Shape.lineRadial().defined(defined).curve(d3Shape[interpolation]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(d3Shape[interpolation]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale)); | ||
var interpolationFunction = typeof props.interpolation === "function" && props.interpolation; | ||
var interpolationName = typeof props.interpolation === "string" && (!openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation)); | ||
return polar ? d3Shape.lineRadial().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale)); | ||
}; | ||
@@ -77,3 +78,3 @@ | ||
Curve.propTypes = _objectSpread({}, CommonProps.primitiveProps, { | ||
interpolation: PropTypes.string, | ||
interpolation: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), | ||
openCurve: PropTypes.bool, | ||
@@ -80,0 +81,0 @@ origin: PropTypes.object, |
@@ -117,3 +117,3 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
value: _objectSpread({}, CommonProps.baseProps, CommonProps.dataProps, { | ||
interpolation: PropTypes.oneOf(["basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"]), | ||
interpolation: PropTypes.oneOfType([PropTypes.oneOf(["basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"]), PropTypes.func]), | ||
label: CustomPropTypes.deprecated(PropTypes.string, "Use `labels` instead for individual data labels") | ||
@@ -120,0 +120,0 @@ }) |
@@ -65,4 +65,5 @@ "use strict"; | ||
var openCurve = props.openCurve === undefined ? defaultOpenCurve : props.openCurve; | ||
var interpolation = !openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation); | ||
return polar ? d3Shape.lineRadial().defined(defined).curve(d3Shape[interpolation]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(d3Shape[interpolation]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale)); | ||
var interpolationFunction = typeof props.interpolation === "function" && props.interpolation; | ||
var interpolationName = typeof props.interpolation === "string" && (!openCurve ? "".concat(toNewName(props.interpolation), "Closed") : toNewName(props.interpolation)); | ||
return polar ? d3Shape.lineRadial().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).angle(getAngleAccessor(scale)).radius(getYAccessor(scale)) : d3Shape.line().defined(defined).curve(interpolationFunction || d3Shape[interpolationName]).x(horizontal ? getYAccessor(scale) : getXAccessor(scale)).y(horizontal ? getXAccessor(scale) : getYAccessor(scale)); | ||
}; | ||
@@ -90,3 +91,3 @@ | ||
Curve.propTypes = _objectSpread({}, _victoryCore.CommonProps.primitiveProps, { | ||
interpolation: _propTypes.default.string, | ||
interpolation: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]), | ||
openCurve: _propTypes.default.bool, | ||
@@ -93,0 +94,0 @@ origin: _propTypes.default.object, |
@@ -132,3 +132,3 @@ "use strict"; | ||
value: _objectSpread({}, _victoryCore.CommonProps.baseProps, _victoryCore.CommonProps.dataProps, { | ||
interpolation: _propTypes.default.oneOf(["basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"]), | ||
interpolation: _propTypes.default.oneOfType([_propTypes.default.oneOf(["basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"]), _propTypes.default.func]), | ||
label: _victoryCore.PropTypes.deprecated(_propTypes.default.string, "Use `labels` instead for individual data labels") | ||
@@ -135,0 +135,0 @@ }) |
{ | ||
"name": "victory-line", | ||
"version": "33.0.1", | ||
"version": "33.0.5", | ||
"description": "Line Component for Victory", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -38,5 +38,6 @@ /*eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/ | ||
const openCurve = props.openCurve === undefined ? defaultOpenCurve : props.openCurve; | ||
const interpolation = !openCurve | ||
? `${toNewName(props.interpolation)}Closed` | ||
: toNewName(props.interpolation); | ||
const interpolationFunction = typeof props.interpolation === "function" && props.interpolation; | ||
const interpolationName = | ||
typeof props.interpolation === "string" && | ||
(!openCurve ? `${toNewName(props.interpolation)}Closed` : toNewName(props.interpolation)); | ||
return polar | ||
@@ -46,3 +47,3 @@ ? d3Shape | ||
.defined(defined) | ||
.curve(d3Shape[interpolation]) | ||
.curve(interpolationFunction || d3Shape[interpolationName]) | ||
.angle(getAngleAccessor(scale)) | ||
@@ -53,3 +54,3 @@ .radius(getYAccessor(scale)) | ||
.defined(defined) | ||
.curve(d3Shape[interpolation]) | ||
.curve(interpolationFunction || d3Shape[interpolationName]) | ||
.x(horizontal ? getYAccessor(scale) : getXAccessor(scale)) | ||
@@ -77,3 +78,3 @@ .y(horizontal ? getXAccessor(scale) : getYAccessor(scale)); | ||
...CommonProps.primitiveProps, | ||
interpolation: PropTypes.string, | ||
interpolation: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), | ||
openCurve: PropTypes.bool, | ||
@@ -80,0 +81,0 @@ origin: PropTypes.object, |
@@ -46,14 +46,17 @@ import PropTypes from "prop-types"; | ||
...CommonProps.dataProps, | ||
interpolation: PropTypes.oneOf([ | ||
"basis", | ||
"bundle", | ||
"cardinal", | ||
"catmullRom", | ||
"linear", | ||
"monotoneX", | ||
"monotoneY", | ||
"natural", | ||
"step", | ||
"stepAfter", | ||
"stepBefore" | ||
interpolation: PropTypes.oneOfType([ | ||
PropTypes.oneOf([ | ||
"basis", | ||
"bundle", | ||
"cardinal", | ||
"catmullRom", | ||
"linear", | ||
"monotoneX", | ||
"monotoneY", | ||
"natural", | ||
"step", | ||
"stepAfter", | ||
"stepBefore" | ||
]), | ||
PropTypes.func | ||
]), | ||
@@ -60,0 +63,0 @@ label: CustomPropTypes.deprecated( |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1279556
23592