victory-polar-axis
Advanced tools
Comparing version 31.0.2 to 31.1.0
@@ -141,6 +141,6 @@ import _isFunction from "lodash/isFunction"; | ||
return Helpers.radiansToDegrees(scale.x(axisValue)); | ||
}; | ||
}; //eslint-disable-next-line max-params | ||
var getTickProps = function (props, calculatedValues, tick, index) { | ||
//eslint-disable-line max-params | ||
var axisType = calculatedValues.axisType, | ||
@@ -217,6 +217,6 @@ radius = calculatedValues.radius, | ||
}; | ||
}; | ||
}; //eslint-disable-next-line max-params | ||
var getGridProps = function (props, calculatedValues, tick, index) { | ||
//eslint-disable-line max-params | ||
var axisType = calculatedValues.axisType, | ||
@@ -223,0 +223,0 @@ radius = calculatedValues.radius, |
@@ -36,21 +36,2 @@ import _assign from "lodash/assign"; | ||
}; | ||
var animationWhitelist = ["style", "domain", "range", "tickCount", "tickValues", "padding", "width", "height"]; | ||
var options = { | ||
components: [{ | ||
name: "axis", | ||
index: 0 | ||
}, { | ||
name: "axisLabel", | ||
index: 0 | ||
}, { | ||
name: "grid" | ||
}, { | ||
name: "parent", | ||
index: "parent" | ||
}, { | ||
name: "ticks" | ||
}, { | ||
name: "tickLabels" | ||
}] | ||
}; | ||
@@ -146,3 +127,5 @@ var VictoryPolarAxis = | ||
value: function render() { | ||
var props = Helpers.modifyProps(this.props, fallbackProps, "axis"); | ||
var animationWhitelist = VictoryPolarAxis.animationWhitelist, | ||
role = VictoryPolarAxis.role; | ||
var props = Helpers.modifyProps(this.props, fallbackProps, role); | ||
@@ -161,2 +144,8 @@ if (this.shouldAnimate()) { | ||
Object.defineProperty(VictoryPolarAxis, "animationWhitelist", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: ["style", "domain", "range", "tickCount", "tickValues", "padding", "width", "height"] | ||
}); | ||
Object.defineProperty(VictoryPolarAxis, "displayName", { | ||
@@ -304,2 +293,2 @@ configurable: true, | ||
}); | ||
export default addEvents(VictoryPolarAxis, options); | ||
export default addEvents(VictoryPolarAxis); |
@@ -162,6 +162,6 @@ "use strict"; | ||
return _victoryCore.Helpers.radiansToDegrees(scale.x(axisValue)); | ||
}; | ||
}; //eslint-disable-next-line max-params | ||
var getTickProps = function (props, calculatedValues, tick, index) { | ||
//eslint-disable-line max-params | ||
var axisType = calculatedValues.axisType, | ||
@@ -240,6 +240,6 @@ radius = calculatedValues.radius, | ||
}; | ||
}; | ||
}; //eslint-disable-next-line max-params | ||
var getGridProps = function (props, calculatedValues, tick, index) { | ||
//eslint-disable-line max-params | ||
var axisType = calculatedValues.axisType, | ||
@@ -246,0 +246,0 @@ radius = calculatedValues.radius, |
@@ -49,21 +49,2 @@ "use strict"; | ||
}; | ||
var animationWhitelist = ["style", "domain", "range", "tickCount", "tickValues", "padding", "width", "height"]; | ||
var options = { | ||
components: [{ | ||
name: "axis", | ||
index: 0 | ||
}, { | ||
name: "axisLabel", | ||
index: 0 | ||
}, { | ||
name: "grid" | ||
}, { | ||
name: "parent", | ||
index: "parent" | ||
}, { | ||
name: "ticks" | ||
}, { | ||
name: "tickLabels" | ||
}] | ||
}; | ||
@@ -158,4 +139,7 @@ var VictoryPolarAxis = | ||
value: function render() { | ||
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, "axis"); | ||
var animationWhitelist = VictoryPolarAxis.animationWhitelist, | ||
role = VictoryPolarAxis.role; | ||
var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
@@ -173,2 +157,8 @@ return this.animateComponent(props, animationWhitelist); | ||
Object.defineProperty(VictoryPolarAxis, "animationWhitelist", { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
value: ["style", "domain", "range", "tickCount", "tickValues", "padding", "width", "height"] | ||
}); | ||
Object.defineProperty(VictoryPolarAxis, "displayName", { | ||
@@ -317,4 +307,4 @@ configurable: true, | ||
var _default = (0, _victoryCore.addEvents)(VictoryPolarAxis, options); | ||
var _default = (0, _victoryCore.addEvents)(VictoryPolarAxis); | ||
exports.default = _default; |
{ | ||
"name": "victory-polar-axis", | ||
"version": "31.0.2", | ||
"version": "31.1.0", | ||
"description": "Polar Axis Component for Victory", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"prop-types": "^15.5.8", | ||
"victory-core": "^31.0.2" | ||
"victory-core": "^31.1.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
@@ -1,2 +0,1 @@ | ||
# VictoryPolarAxis | ||
@@ -44,2 +43,3 @@ | ||
``` | ||
### axisAngle | ||
@@ -51,3 +51,3 @@ | ||
*default:* `axisAngle={0}` | ||
_default:_ `axisAngle={0}` | ||
@@ -67,3 +67,3 @@ ```playground | ||
*default:* `axisComponent={<Line type={"axis"}/>}` | ||
_default:_ `axisComponent={<Line type={"axis"}/>}` | ||
@@ -82,3 +82,3 @@ ```jsx | ||
*default:* `axisLabelComponent={<VictoryLabel/>}` | ||
_default:_ `axisLabelComponent={<VictoryLabel/>}` | ||
@@ -95,3 +95,2 @@ ```jsx | ||
```playground | ||
@@ -134,3 +133,3 @@ <VictoryChart polar | ||
*default:* `circularAxisComponent={<Arc type={"axis"}/>}` | ||
_default:_ `circularAxisComponent={<Arc type={"axis"}/>}` | ||
@@ -147,3 +146,3 @@ ```jsx | ||
*default:* `circularGridComponent={<Arc type={"grid"}/>}` | ||
_default:_ `circularGridComponent={<Arc type={"grid"}/>}` | ||
@@ -173,3 +172,3 @@ ```jsx | ||
*default:* `dependentAxis={false}` | ||
_default:_ `dependentAxis={false}` | ||
@@ -209,5 +208,4 @@ ```playground | ||
*default:* `endAngle={360}` | ||
_default:_ `endAngle={360}` | ||
```playground | ||
@@ -235,3 +233,3 @@ <div style={{ display: "flex" }}> | ||
See the [Events Guide] []for more information on defining events. | ||
See the [Events Guide][]for more information on defining events. | ||
@@ -253,3 +251,3 @@ **note:** valid event targets for `VictoryPolarAxis` are "axis", "axisLabel", "grid", "ticks", and "tickLabels". | ||
*default:* `gridComponent={<Line type={"grid"}/>}` | ||
_default:_ `gridComponent={<Line type={"grid"}/>}` | ||
@@ -266,3 +264,3 @@ ```jsx | ||
*default:* `<g/>` | ||
_default:_ `<g/>` | ||
@@ -279,3 +277,3 @@ ```jsx | ||
*default (provided by default theme):* `height={300}` | ||
_default (provided by default theme):_ `height={300}` | ||
@@ -295,2 +293,3 @@ ```jsx | ||
``` | ||
### invertAxis | ||
@@ -302,3 +301,3 @@ | ||
*default:* `invertAxis={false}` | ||
_default:_ `invertAxis={false}` | ||
@@ -325,3 +324,3 @@ ### label | ||
*default:* `labelPlacement="parallel"` | ||
_default:_ `labelPlacement="parallel"` | ||
@@ -341,3 +340,2 @@ ```playground | ||
```playground | ||
@@ -357,3 +355,2 @@ <VictoryPolarAxis | ||
```playground | ||
@@ -374,3 +371,3 @@ <VictoryPolarAxis | ||
```jsx | ||
name="series-1" | ||
name = "series-1"; | ||
``` | ||
@@ -392,3 +389,3 @@ | ||
*default (provided by default theme):* `padding={50}` | ||
_default (provided by default theme):_ `padding={50}` | ||
@@ -416,3 +413,3 @@ ```jsx | ||
*default:* `scale="linear"` | ||
_default:_ `scale="linear"` | ||
@@ -441,3 +438,3 @@ ```jsx | ||
*default:* `standalone={true}` | ||
_default:_ `standalone={true}` | ||
@@ -465,5 +462,4 @@ ```playground | ||
*default:* `startAngle={0}` | ||
_default:_ `startAngle={0}` | ||
```playground | ||
@@ -495,3 +491,3 @@ <div style={{ display: "flex" }}> | ||
*default (provided by default theme):* See [grayscale theme][] for more detail | ||
_default (provided by default theme):_ See [grayscale theme][] for more detail | ||
@@ -516,5 +512,5 @@ ```playground | ||
*default:* `theme={VictoryTheme.grayscale}` | ||
_default:_ `theme={VictoryTheme.grayscale}` | ||
*Note:* Use the `dependentAxis` and `independentAxis` namespaces to theme axes by type. These namespaces will be merged with any props and styles supplied in the `axis` namespace. | ||
_Note:_ Use the `dependentAxis` and `independentAxis` namespaces to theme axes by type. These namespaces will be merged with any props and styles supplied in the `axis` namespace. | ||
@@ -531,3 +527,3 @@ ```jsx | ||
*default:* `tickComponent={<Line type={"tick"}/>}` | ||
_default:_ `tickComponent={<Line type={"tick"}/>}` | ||
@@ -564,3 +560,3 @@ ```jsx | ||
*default:* `tickLabelComponent={<VictoryLabel/>}` | ||
_default:_ `tickLabelComponent={<VictoryLabel/>}` | ||
@@ -575,3 +571,3 @@ ```jsx | ||
The `tickValues` prop explicitly specifies a set of tick values to draw on the axis. This prop should be given as an array of unique values of the same type (_i.e.,_ all numbers). The `tickValues` prop is used to specify the _values_ of each tick, so numeric values are typically appropriate. An array of strings or dates may be supplied for categorical and time series data respectively. Use the [tickFormat][] prop to specify how ticks should be labeled. *Note:* `tickValues` should be given as a unique array. | ||
The `tickValues` prop explicitly specifies a set of tick values to draw on the axis. This prop should be given as an array of unique values of the same type (_i.e.,_ all numbers). The `tickValues` prop is used to specify the _values_ of each tick, so numeric values are typically appropriate. An array of strings or dates may be supplied for categorical and time series data respectively. Use the [tickFormat][] prop to specify how ticks should be labeled. _Note:_ `tickValues` should be given as a unique array. | ||
@@ -591,3 +587,3 @@ ```playground | ||
*default (provided by default theme):* `width={450}` | ||
_default (provided by default theme):_ `width={450}` | ||
@@ -598,11 +594,11 @@ ```jsx | ||
[Animations Guide]: https://formidable.com/open-source/victory/guides/animations | ||
[Events Guide]: https://formidable.com/open-source/victory/guides/events | ||
[Themes Guide]: https://formidable.com/open-source/victory/guides/themes | ||
[`VictoryChart`]: https://formidable.com/open-source/victory/docs/victory-chart | ||
[tickFormat]: https://formidable.com/open-source/victory/docs/victory-axis#tickformat | ||
[d3Scale]: https://github.com/d3/d3-scale | ||
[animations guide]: https://formidable.com/open-source/victory/guides/animations | ||
[events guide]: https://formidable.com/open-source/victory/guides/events | ||
[themes guide]: https://formidable.com/open-source/victory/guides/themes | ||
[`victorychart`]: https://formidable.com/open-source/victory/docs/victory-chart | ||
[tickformat]: https://formidable.com/open-source/victory/docs/victory-axis#tickformat | ||
[d3scale]: https://github.com/d3/d3-scale | ||
[grayscale theme]: https://github.com/FormidableLabs/victory-core/blob/master/src/victory-theme/grayscale.js | ||
[Line component]: https://formidable.com/open-source/victory/docs/victory-primitives#line | ||
[Arc component]: https://formidable.com/open-source/victory/docs/victory-primitives#arc | ||
[`VictoryLabel`]: https://formidable.com/open-source/victory/docs/victory-label | ||
[line component]: https://formidable.com/open-source/victory/docs/victory-primitives#line | ||
[arc component]: https://formidable.com/open-source/victory/docs/victory-primitives#arc | ||
[`victorylabel`]: https://formidable.com/open-source/victory/docs/victory-label |
@@ -55,4 +55,5 @@ import { assign, uniqBy, defaults, isFunction } from "lodash"; | ||
return generalAxisStyle && specificAxisStyle ? | ||
mergeStyles() : specificAxisStyle || generalAxisStyle; | ||
return generalAxisStyle && specificAxisStyle | ||
? mergeStyles() | ||
: specificAxisStyle || generalAxisStyle; | ||
}; | ||
@@ -117,3 +118,4 @@ | ||
const getTickProps = (props, calculatedValues, tick, index) => { //eslint-disable-line max-params | ||
//eslint-disable-next-line max-params | ||
const getTickProps = (props, calculatedValues, tick, index) => { | ||
const { axisType, radius, scale, style, stringTicks } = calculatedValues; | ||
@@ -125,16 +127,21 @@ const originalTick = stringTicks ? stringTicks[index] : tick; | ||
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined; | ||
return axisType === "angular" ? | ||
{ | ||
index, datum: tick, style: tickStyle, | ||
x1: radius * Math.cos(scale(tick)), | ||
y1: -radius * Math.sin(scale(tick)), | ||
x2: (radius + tickPadding) * Math.cos(scale(tick)), | ||
y2: -(radius + tickPadding) * Math.sin(scale(tick)) | ||
} : { | ||
style, index, datum: tick, | ||
x1: (scale(tick) / 2) * Math.cos(axisAngle - angularPadding), | ||
x2: (scale(tick) / 2) * Math.cos(axisAngle + angularPadding), | ||
y1: -(scale(tick) / 2) * Math.sin(axisAngle - angularPadding), | ||
y2: -(scale(tick) / 2) * Math.sin(axisAngle + angularPadding) | ||
}; | ||
return axisType === "angular" | ||
? { | ||
index, | ||
datum: tick, | ||
style: tickStyle, | ||
x1: radius * Math.cos(scale(tick)), | ||
y1: -radius * Math.sin(scale(tick)), | ||
x2: (radius + tickPadding) * Math.cos(scale(tick)), | ||
y2: -(radius + tickPadding) * Math.sin(scale(tick)) | ||
} | ||
: { | ||
style, | ||
index, | ||
datum: tick, | ||
x1: (scale(tick) / 2) * Math.cos(axisAngle - angularPadding), | ||
x2: (scale(tick) / 2) * Math.cos(axisAngle + angularPadding), | ||
y1: -(scale(tick) / 2) * Math.sin(axisAngle - angularPadding), | ||
y2: -(scale(tick) / 2) * Math.sin(axisAngle + angularPadding) | ||
}; | ||
}; | ||
@@ -148,17 +155,23 @@ | ||
const { tickLabelComponent } = props; | ||
const labelPlacement = tickLabelComponent.props && tickLabelComponent.props.labelPlacement ? | ||
tickLabelComponent.props.labelPlacement : props.labelPlacement; | ||
const labelPlacement = | ||
tickLabelComponent.props && tickLabelComponent.props.labelPlacement | ||
? tickLabelComponent.props.labelPlacement | ||
: props.labelPlacement; | ||
const tickPadding = labelStyle.padding || 0; | ||
const angularPadding = 0; // TODO: do some geometry | ||
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined; | ||
const labelAngle = axisType === "angular" ? | ||
Helpers.radiansToDegrees(scale(tick)) : axisAngle + angularPadding; | ||
const textAngle = labelStyle.angle === undefined ? | ||
LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), labelAngle) : | ||
labelStyle.angle; | ||
const labelAngle = | ||
axisType === "angular" ? Helpers.radiansToDegrees(scale(tick)) : axisAngle + angularPadding; | ||
const textAngle = | ||
labelStyle.angle === undefined | ||
? LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), labelAngle) | ||
: labelStyle.angle; | ||
const labelRadius = axisType === "angular" ? radius + tickPadding : scale(tick); | ||
const textAnchor = labelStyle.textAnchor || | ||
const textAnchor = | ||
labelStyle.textAnchor || | ||
LabelHelpers.getPolarTextAnchor(assign({}, props, { labelPlacement }), labelAngle); | ||
return { | ||
index, datum: tick, style: labelStyle, | ||
index, | ||
datum: tick, | ||
style: labelStyle, | ||
angle: textAngle, | ||
@@ -172,3 +185,4 @@ textAnchor, | ||
const getGridProps = (props, calculatedValues, tick, index) => { //eslint-disable-line max-params | ||
//eslint-disable-next-line max-params | ||
const getGridProps = (props, calculatedValues, tick, index) => { | ||
const { axisType, radius, style, scale, stringTicks } = calculatedValues; | ||
@@ -179,13 +193,22 @@ const { startAngle, endAngle, innerRadius = 0 } = props; | ||
const angle = scale(tick); | ||
return axisType === "angular" ? | ||
{ | ||
index, datum: tick, style: gridStyle, | ||
x1: getPosition(radius, angle, "x"), | ||
y1: getPosition(radius, angle, "y"), | ||
x2: getPosition(innerRadius, angle, "x"), | ||
y2: getPosition(innerRadius, angle, "y") | ||
} : { | ||
style: gridStyle, index, datum: tick, | ||
cx: 0, cy: 0, r: scale(tick), startAngle, endAngle | ||
}; | ||
return axisType === "angular" | ||
? { | ||
index, | ||
datum: tick, | ||
style: gridStyle, | ||
x1: getPosition(radius, angle, "x"), | ||
y1: getPosition(radius, angle, "y"), | ||
x2: getPosition(innerRadius, angle, "x"), | ||
y2: getPosition(innerRadius, angle, "y") | ||
} | ||
: { | ||
style: gridStyle, | ||
index, | ||
datum: tick, | ||
cx: 0, | ||
cy: 0, | ||
r: scale(tick), | ||
startAngle, | ||
endAngle | ||
}; | ||
}; | ||
@@ -199,12 +222,18 @@ | ||
} | ||
const labelPlacement = axisLabelComponent.props && axisLabelComponent.props.labelPlacement ? | ||
axisLabelComponent.props.labelPlacement : props.labelPlacement; | ||
const labelStyle = style && style.axisLabel || {}; | ||
const labelPlacement = | ||
axisLabelComponent.props && axisLabelComponent.props.labelPlacement | ||
? axisLabelComponent.props.labelPlacement | ||
: props.labelPlacement; | ||
const labelStyle = (style && style.axisLabel) || {}; | ||
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined; | ||
const textAngle = labelStyle.angle === undefined ? | ||
LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), axisAngle) : labelStyle.angle; | ||
const textAngle = | ||
labelStyle.angle === undefined | ||
? LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), axisAngle) | ||
: labelStyle.angle; | ||
const labelRadius = radius + (labelStyle.padding || 0); | ||
const textAnchor = labelStyle.textAnchor || | ||
const textAnchor = | ||
labelStyle.textAnchor || | ||
LabelHelpers.getTextPolarAnchor(assign({}, props, { labelPlacement }), axisAngle); | ||
const verticalAnchor = labelStyle.verticalAnchor || | ||
const verticalAnchor = | ||
labelStyle.verticalAnchor || | ||
LabelHelpers.getPolarVerticalAnchor(assign({}, props, { labelPlacement }), axisAngle); | ||
@@ -225,15 +254,22 @@ return { | ||
const { startAngle, endAngle, innerRadius = 0 } = modifiedProps; | ||
const axisAngle = axisType === "radial" ? | ||
Helpers.degreesToRadians(getAxisAngle(modifiedProps, scale)) : undefined; | ||
return axisType === "radial" ? | ||
{ | ||
style: style.axis, | ||
x1: getPosition(innerRadius, axisAngle, "x"), | ||
x2: getPosition(radius, axisAngle, "x"), | ||
y1: getPosition(innerRadius, axisAngle, "y"), | ||
y2: getPosition(radius, axisAngle, "y") | ||
} : { | ||
style: style.axis, | ||
cx: 0, cy: 0, r: radius, startAngle, endAngle | ||
}; | ||
const axisAngle = | ||
axisType === "radial" | ||
? Helpers.degreesToRadians(getAxisAngle(modifiedProps, scale)) | ||
: undefined; | ||
return axisType === "radial" | ||
? { | ||
style: style.axis, | ||
x1: getPosition(innerRadius, axisAngle, "x"), | ||
x2: getPosition(radius, axisAngle, "x"), | ||
y1: getPosition(innerRadius, axisAngle, "y"), | ||
y2: getPosition(radius, axisAngle, "y") | ||
} | ||
: { | ||
style: style.axis, | ||
cx: 0, | ||
cy: 0, | ||
r: radius, | ||
startAngle, | ||
endAngle | ||
}; | ||
}; | ||
@@ -243,10 +279,6 @@ | ||
if (props.dependentAxis) { | ||
return props.theme && props.theme.dependentAxis | ||
? "dependentAxis" | ||
: "axis"; | ||
return props.theme && props.theme.dependentAxis ? "dependentAxis" : "axis"; | ||
} | ||
return props.theme && props.theme.independentAxis | ||
? "independentAxis" | ||
: "axis"; | ||
return props.theme && props.theme.independentAxis ? "independentAxis" : "axis"; | ||
}; | ||
@@ -282,3 +314,13 @@ | ||
return { | ||
axis, style, padding, stringTicks, axisType, scale, ticks, tickFormat, domain, range, radius | ||
axis, | ||
style, | ||
padding, | ||
stringTicks, | ||
axisType, | ||
scale, | ||
ticks, | ||
tickFormat, | ||
domain, | ||
range, | ||
radius | ||
}; | ||
@@ -295,4 +337,14 @@ }; | ||
const axisLabelProps = getAxisLabelProps(props, calculatedValues); | ||
const initialChildProps = { parent: | ||
{ style: style.parent, ticks, scale, width, height, domain, standalone, theme, name } | ||
const initialChildProps = { | ||
parent: { | ||
style: style.parent, | ||
ticks, | ||
scale, | ||
width, | ||
height, | ||
domain, | ||
standalone, | ||
theme, | ||
name | ||
} | ||
}; | ||
@@ -314,2 +366,1 @@ | ||
export { getScale, getStyles, getBaseProps }; | ||
@@ -5,4 +5,12 @@ import React from "react"; | ||
import { | ||
PropTypes as CustomPropTypes, Helpers, VictoryLabel, CommonProps, | ||
VictoryContainer, VictoryTheme, LineSegment, addEvents, Arc, Axis | ||
PropTypes as CustomPropTypes, | ||
Helpers, | ||
VictoryLabel, | ||
CommonProps, | ||
VictoryContainer, | ||
VictoryTheme, | ||
LineSegment, | ||
addEvents, | ||
Arc, | ||
Axis | ||
} from "victory-core"; | ||
@@ -17,18 +25,14 @@ import { getScale, getStyles, getBaseProps } from "./helper-methods"; | ||
const animationWhitelist = [ | ||
"style", "domain", "range", "tickCount", "tickValues", "padding", "width", "height" | ||
]; | ||
class VictoryPolarAxis extends React.Component { | ||
static animationWhitelist = [ | ||
"style", | ||
"domain", | ||
"range", | ||
"tickCount", | ||
"tickValues", | ||
"padding", | ||
"width", | ||
"height" | ||
]; | ||
const options = { | ||
components: [ | ||
{ name: "axis", index: 0 }, | ||
{ name: "axisLabel", index: 0 }, | ||
{ name: "grid" }, | ||
{ name: "parent", index: "parent" }, | ||
{ name: "ticks" }, | ||
{ name: "tickLabels" } | ||
] | ||
}; | ||
class VictoryPolarAxis extends React.Component { | ||
static displayName = "VictoryAxis"; | ||
@@ -56,3 +60,4 @@ | ||
PropTypes.shape({ | ||
x: PropTypes.arrayOf(PropTypes.string), y: PropTypes.arrayOf(PropTypes.string) | ||
x: PropTypes.arrayOf(PropTypes.string), | ||
y: PropTypes.arrayOf(PropTypes.string) | ||
}) | ||
@@ -65,11 +70,13 @@ ]), | ||
endAngle: PropTypes.number, | ||
events: PropTypes.arrayOf(PropTypes.shape({ | ||
target: PropTypes.oneOf(["axis", "axisLabel", "grid", "ticks", "tickLabels"]), | ||
eventKey: PropTypes.oneOfType([ | ||
PropTypes.array, | ||
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), | ||
PropTypes.string | ||
]), | ||
eventHandlers: PropTypes.object | ||
})), | ||
events: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
target: PropTypes.oneOf(["axis", "axisLabel", "grid", "ticks", "tickLabels"]), | ||
eventKey: PropTypes.oneOfType([ | ||
PropTypes.array, | ||
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]), | ||
PropTypes.string | ||
]), | ||
eventHandlers: PropTypes.object | ||
}) | ||
), | ||
gridComponent: PropTypes.element, | ||
@@ -81,10 +88,15 @@ innerRadius: CustomPropTypes.nonNegative, | ||
style: PropTypes.shape({ | ||
parent: PropTypes.object, axis: PropTypes.object, axisLabel: PropTypes.object, | ||
grid: PropTypes.object, ticks: PropTypes.object, tickLabels: PropTypes.object | ||
parent: PropTypes.object, | ||
axis: PropTypes.object, | ||
axisLabel: PropTypes.object, | ||
grid: PropTypes.object, | ||
ticks: PropTypes.object, | ||
tickLabels: PropTypes.object | ||
}), | ||
tickComponent: PropTypes.element, | ||
tickCount: CustomPropTypes.allOfType([ | ||
CustomPropTypes.integer, CustomPropTypes.greaterThanZero | ||
CustomPropTypes.integer, | ||
CustomPropTypes.greaterThanZero | ||
]), | ||
tickFormat: PropTypes.oneOfType([ PropTypes.func, CustomPropTypes.homogeneousArray ]), | ||
tickFormat: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.homogeneousArray]), | ||
tickLabelComponent: PropTypes.element, | ||
@@ -95,10 +107,10 @@ tickValues: CustomPropTypes.homogeneousArray | ||
static defaultProps = { | ||
axisComponent: <LineSegment type={"axis"}/>, | ||
axisLabelComponent: <VictoryLabel/>, | ||
circularAxisComponent: <Arc type={"axis"}/>, | ||
circularGridComponent: <Arc type={"grid"}/>, | ||
axisComponent: <LineSegment type={"axis"} />, | ||
axisLabelComponent: <VictoryLabel />, | ||
circularAxisComponent: <Arc type={"axis"} />, | ||
circularGridComponent: <Arc type={"grid"} />, | ||
containerComponent: <VictoryContainer />, | ||
endAngle: 360, | ||
gridComponent: <LineSegment type={"grid"}/>, | ||
groupComponent: <g role="presentation"/>, | ||
gridComponent: <LineSegment type={"grid"} />, | ||
groupComponent: <g role="presentation" />, | ||
labelPlacement: "parallel", | ||
@@ -109,4 +121,4 @@ scale: "linear", | ||
theme: VictoryTheme.grayscale, | ||
tickComponent: <LineSegment type={"tick"}/>, | ||
tickLabelComponent: <VictoryLabel/> | ||
tickComponent: <LineSegment type={"tick"} />, | ||
tickLabelComponent: <VictoryLabel /> | ||
}; | ||
@@ -120,4 +132,10 @@ | ||
static expectedComponents = [ | ||
"axisComponent", "circularAxisComponent", "groupComponent", "containerComponent", | ||
"tickComponent", "tickLabelComponent", "gridComponent", "circularGridComponent" | ||
"axisComponent", | ||
"circularAxisComponent", | ||
"groupComponent", | ||
"containerComponent", | ||
"tickComponent", | ||
"tickLabelComponent", | ||
"gridComponent", | ||
"circularGridComponent" | ||
]; | ||
@@ -147,3 +165,4 @@ | ||
const tickProps = assign( | ||
{ key: `${name}-tick-${key}` }, this.getComponentProps(tickComponent, "ticks", index) | ||
{ key: `${name}-tick-${key}` }, | ||
this.getComponentProps(tickComponent, "ticks", index) | ||
); | ||
@@ -155,3 +174,4 @@ return React.cloneElement(tickComponent, tickProps); | ||
const gridProps = assign( | ||
{ key: `${name}-grid-${key}` }, this.getComponentProps(gridComponent, "grid", index) | ||
{ key: `${name}-grid-${key}` }, | ||
this.getComponentProps(gridComponent, "grid", index) | ||
); | ||
@@ -171,3 +191,7 @@ return React.cloneElement(gridComponent, gridProps); | ||
const children = [ | ||
axis, axisLabel, ...tickComponents, ...gridComponents, ...tickLabelComponents | ||
axis, | ||
axisLabel, | ||
...tickComponents, | ||
...gridComponents, | ||
...tickLabelComponents | ||
]; | ||
@@ -191,3 +215,5 @@ return this.renderGroup(props, children); | ||
render() { | ||
const props = Helpers.modifyProps(this.props, fallbackProps, "axis"); | ||
const { animationWhitelist, role } = VictoryPolarAxis; | ||
const props = Helpers.modifyProps(this.props, fallbackProps, role); | ||
if (this.shouldAnimate()) { | ||
@@ -201,2 +227,2 @@ return this.animateComponent(props, animationWhitelist); | ||
export default addEvents(VictoryPolarAxis, options); | ||
export default addEvents(VictoryPolarAxis); |
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
1235970
22417
575
Updatedvictory-core@^31.1.0