New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

victory-axis

Package Overview
Dependencies
Maintainers
42
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-axis - npm Package Compare versions

Comparing version 35.8.3 to 35.9.0

4

package.json
{
"name": "victory-axis",
"version": "35.8.3",
"version": "35.9.0",
"description": "Axis Component for Victory",

@@ -24,3 +24,3 @@ "keywords": [

"prop-types": "^15.5.8",
"victory-core": "^35.8.1"
"victory-core": "^35.9.0"
},

@@ -27,0 +27,0 @@ "scripts": {

@@ -41,5 +41,16 @@ import { assign, defaults } from "lodash";

const mergeStyles = () => {
const styleNamespaces = ["axis", "axisLabel", "grid", "parent", "tickLabels", "ticks"];
const styleNamespaces = [
"axis",
"axisLabel",
"grid",
"parent",
"tickLabels",
"ticks"
];
return styleNamespaces.reduce((memo, curr) => {
memo[curr] = defaults({}, specificAxisStyle[curr], generalAxisStyle[curr]);
memo[curr] = defaults(
{},
specificAxisStyle[curr],
generalAxisStyle[curr]
);
return memo;

@@ -113,5 +124,9 @@ }, {});

x1: isVertical ? globalTransform.x : padding.left + globalTransform.x,
x2: isVertical ? globalTransform.x : width - padding.right + globalTransform.x,
x2: isVertical
? globalTransform.x
: width - padding.right + globalTransform.x,
y1: isVertical ? padding.top + globalTransform.y : globalTransform.y,
y2: isVertical ? height - padding.bottom + globalTransform.y : globalTransform.y
y2: isVertical
? height - padding.bottom + globalTransform.y
: globalTransform.y
};

@@ -129,3 +144,4 @@ };

const getAxisLabelProps = (props, calculatedValues, globalTransform) => {
const { style, orientation, padding, labelPadding, isVertical } = calculatedValues;
const { style, orientation, padding, labelPadding, isVertical } =
calculatedValues;
const sign = orientationSign[orientation];

@@ -156,3 +172,8 @@ const hPadding = padding.left + padding.right;

const getAnchors = (orientation, isVertical) => {
const anchorOrientation = { top: "end", left: "end", right: "start", bottom: "start" };
const anchorOrientation = {
top: "end",
left: "end",
right: "start",
bottom: "start"
};
const anchor = anchorOrientation[orientation];

@@ -188,3 +209,5 @@ return {

};
return horizontal ? horizontalOrientations[sign][axis] : orientations[sign][axis];
return horizontal
? horizontalOrientations[sign][axis]
: orientations[sign][axis];
};

@@ -205,11 +228,26 @@

const { polar, horizontal } = props;
const sharedProps = { scale: { [axis]: scale }, polar, horizontal, ticks, stringTicks };
const sharedProps = {
scale: { [axis]: scale },
polar,
horizontal,
ticks,
stringTicks
};
const xPadding = orientation === "right" ? padding.right : padding.left;
const yPadding = orientation === "top" ? padding.top : padding.bottom;
const offsetX = props.offsetX !== null && props.offsetX !== undefined ? props.offsetX : xPadding;
const offsetY = props.offsetY !== null && props.offsetY !== undefined ? props.offsetY : yPadding;
const offsetX =
props.offsetX !== null && props.offsetX !== undefined
? props.offsetX
: xPadding;
const offsetY =
props.offsetY !== null && props.offsetY !== undefined
? props.offsetY
: yPadding;
const fontSize = style.axisLabel.fontSize || 14; // eslint-disable-line no-magic-numbers
const tickSizes = ticks.map((data, index) => {
const tick = stringTicks ? props.tickValues[data - 1] : data;
const tickStyle = Helpers.evaluateStyle(style.ticks, assign({}, sharedProps, { tick, index }));
const tickStyle = Helpers.evaluateStyle(
style.ticks,
assign({}, sharedProps, { tick, index })
);
return tickStyle.size || 0;

@@ -230,8 +268,15 @@ });

const getOffset = (props, calculatedValues) => {
const { scale, origin, orientation, orientations, domain, padding } = calculatedValues;
const { scale, origin, orientation, orientations, domain, padding } =
calculatedValues;
const { top, bottom, left, right } = padding;
const calculatedOrientation = {
x: orientation === "bottom" || orientation === "top" ? orientation : orientations.x,
y: orientation === "left" || orientation === "right" ? orientation : orientations.y
x:
orientation === "bottom" || orientation === "top"
? orientation
: orientations.x,
y:
orientation === "left" || orientation === "right"
? orientation
: orientations.y
};

@@ -249,8 +294,18 @@

const originPosition = {
x: origin.x === domain.x[0] || origin.x === domain.x[1] ? 0 : scale.x(origin.x),
y: origin.y === domain.y[0] || origin.y === domain.y[1] ? 0 : scale.y(origin.y)
x:
origin.x === domain.x[0] || origin.x === domain.x[1]
? 0
: scale.x(origin.x),
y:
origin.y === domain.y[0] || origin.y === domain.y[1]
? 0
: scale.y(origin.y)
};
const x = originPosition.x ? Math.abs(originOffset.x - originPosition.x) : orientationOffset.x;
const y = originPosition.y ? Math.abs(originOffset.y - originPosition.y) : orientationOffset.y;
const x = originPosition.x
? Math.abs(originOffset.x - originPosition.x)
: orientationOffset.x;
const y = originPosition.y
? Math.abs(originOffset.y - originPosition.y)
: orientationOffset.y;
const offsetX = exists(props.offsetX) ? props.offsetX : x;

@@ -267,8 +322,15 @@ const offsetY = exists(props.offsetY) ? props.offsetY : y;

const getHorizontalOffset = (props, calculatedValues) => {
const { scale, origin, orientation, orientations, domain, padding } = calculatedValues;
const { scale, origin, orientation, orientations, domain, padding } =
calculatedValues;
const { top, bottom, left, right } = padding;
const calculatedOrientation = {
y: orientation === "bottom" || orientation === "top" ? orientation : orientations.x,
x: orientation === "left" || orientation === "right" ? orientation : orientations.y
y:
orientation === "bottom" || orientation === "top"
? orientation
: orientations.x,
x:
orientation === "left" || orientation === "right"
? orientation
: orientations.y
};

@@ -286,8 +348,18 @@

const originPosition = {
x: origin.x === domain.x[0] || origin.x === domain.x[1] ? 0 : scale.x(origin.x),
y: origin.y === domain.y[0] || origin.y === domain.y[1] ? 0 : scale.y(origin.y)
x:
origin.x === domain.x[0] || origin.x === domain.x[1]
? 0
: scale.x(origin.x),
y:
origin.y === domain.y[0] || origin.y === domain.y[1]
? 0
: scale.y(origin.y)
};
const y = originPosition.x ? Math.abs(originOffset.x - originPosition.x) : orientationOffset.x;
const x = originPosition.y ? Math.abs(originOffset.y - originPosition.y) : orientationOffset.y;
const y = originPosition.x
? Math.abs(originOffset.x - originPosition.x)
: orientationOffset.x;
const x = originPosition.y
? Math.abs(originOffset.y - originPosition.y)
: orientationOffset.y;
const offsetX = exists(props.offsetX) ? props.offsetX : x;

@@ -350,4 +422,8 @@ const offsetY = exists(props.offsetY) ? props.offsetY : y;

const sign = -orientationSign[orientation];
const x = isVertical ? sign * (props.width - (padding.left + padding.right)) : 0;
const y = isVertical ? 0 : sign * (props.height - (padding.top + padding.bottom));
const x = isVertical
? sign * (props.width - (padding.left + padding.right))
: 0;
const y = isVertical
? 0
: sign * (props.height - (padding.top + padding.bottom));
return { x, y };

@@ -390,3 +466,5 @@ };

};
return props.dependentAxis ? defaultOrientations.dependent : defaultOrientations.independent;
return props.dependentAxis
? defaultOrientations.dependent
: defaultOrientations.independent;
};

@@ -408,3 +486,4 @@

const yAxisScale = axis === "y" ? axisScale : undefined;
const crossAxis = props.crossAxis === false || props.standalone === true ? false : true;
const crossAxis =
props.crossAxis === false || props.standalone === true ? false : true;
const ticks = Axis.getTicks(props, axisScale, crossAxis);

@@ -492,10 +571,34 @@ const tickFormat = Axis.getTickFormat(props, axisScale);

const otherAxis = axis === "x" ? "y" : "x";
const { width, height, standalone, theme, polar, padding, horizontal } = props;
const { globalTransform, gridOffset, gridEdge } = getLayoutProps(props, calculatedValues);
const sharedProps = { scale: { [axis]: scale[axis] }, polar, horizontal, ticks, stringTicks };
const { width, height, standalone, theme, polar, padding, horizontal } =
props;
const { globalTransform, gridOffset, gridEdge } = getLayoutProps(
props,
calculatedValues
);
const sharedProps = {
scale: { [axis]: scale[axis] },
polar,
horizontal,
ticks,
stringTicks
};
const axisProps = getAxisProps(props, calculatedValues, globalTransform);
const axisLabelProps = getAxisLabelProps(props, calculatedValues, globalTransform);
const axisLabelProps = getAxisLabelProps(
props,
calculatedValues,
globalTransform
);
const initialChildProps = {
parent: assign(
{ style: style.parent, ticks, standalone, theme, width, height, padding, domain, name },
{
style: style.parent,
ticks,
standalone,
theme,
width,
height,
padding,
domain,
name
},
sharedProps

@@ -508,3 +611,5 @@ )

scale:
props.scale && props.scale[otherAxis] ? { [otherAxis]: props.scale[otherAxis] } : undefined
props.scale && props.scale[otherAxis]
? { [otherAxis]: props.scale[otherAxis] }
: undefined
};

@@ -520,3 +625,7 @@ return ticks.reduce((childProps, tickValue, index) => {

position: getTickPosition(styles, orientation, isVertical),
transform: getTickTransform(scale[axis](tickValue), globalTransform, isVertical)
transform: getTickTransform(
scale[axis](tickValue),
globalTransform,
isVertical
)
};

@@ -538,7 +647,17 @@

axisLabel: assign({}, sharedProps, axisLabelProps),
ticks: assign({}, sharedProps, getTickProps(tickLayout, styles.tickStyle, tickValue)),
ticks: assign(
{},
sharedProps,
getTickProps(tickLayout, styles.tickStyle, tickValue)
),
tickLabels: assign(
{},
sharedProps,
getTickLabelProps(tickLayout, styles.labelStyle, anchors, tickValue, text)
getTickLabelProps(
tickLayout,
styles.labelStyle,
anchors,
tickValue,
text
)
),

@@ -545,0 +664,0 @@ grid: assign(

@@ -65,3 +65,7 @@ import PropTypes from "prop-types";

axisLabelComponent: PropTypes.element,
axisValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object]),
axisValue: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
PropTypes.object
]),
categories: PropTypes.oneOfType([

@@ -78,6 +82,15 @@ PropTypes.arrayOf(PropTypes.string),

PropTypes.shape({
target: PropTypes.oneOf(["axis", "axisLabel", "grid", "ticks", "tickLabels"]),
target: PropTypes.oneOf([
"axis",
"axisLabel",
"grid",
"ticks",
"tickLabels"
]),
eventKey: PropTypes.oneOfType([
PropTypes.array,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string

@@ -111,3 +124,6 @@ ]),

]),
tickFormat: PropTypes.oneOfType([PropTypes.func, CustomPropTypes.homogeneousArray]),
tickFormat: PropTypes.oneOfType([
PropTypes.func,
CustomPropTypes.homogeneousArray
]),
tickLabelComponent: PropTypes.element,

@@ -155,3 +171,7 @@ tickValues: CustomPropTypes.homogeneousArray

}
const axisLabelProps = this.getComponentProps(axisLabelComponent, "axisLabel", 0);
const axisLabelProps = this.getComponentProps(
axisLabelComponent,
"axisLabel",
0
);
return React.cloneElement(axisLabelComponent, axisLabelProps);

@@ -165,3 +185,5 @@ }

const visible =
style.stroke !== "transparent" && style.stroke !== "none" && style.strokeWidth !== 0;
style.stroke !== "transparent" &&
style.stroke !== "none" &&
style.strokeWidth !== 0;
return visible || !isEmpty(events);

@@ -173,9 +195,19 @@ };

const BaseTickComponent = React.cloneElement(tickComponent, tickProps);
const TickComponent = shouldRender(BaseTickComponent.props) ? BaseTickComponent : undefined;
const TickComponent = shouldRender(BaseTickComponent.props)
? BaseTickComponent
: undefined;
const gridProps = this.getComponentProps(gridComponent, "grid", index);
const BaseGridComponent = React.cloneElement(gridComponent, gridProps);
const GridComponent = shouldRender(BaseGridComponent.props) ? BaseGridComponent : undefined;
const tickLabelProps = this.getComponentProps(tickLabelComponent, "tickLabels", index);
const GridComponent = shouldRender(BaseGridComponent.props)
? BaseGridComponent
: undefined;
const tickLabelProps = this.getComponentProps(
tickLabelComponent,
"tickLabels",
index
);
const TickLabel = React.cloneElement(tickLabelComponent, tickLabelProps);
const children = [GridComponent, TickComponent, TickLabel].filter(Boolean);
const children = [GridComponent, TickComponent, TickLabel].filter(
Boolean
);
return React.cloneElement(

@@ -217,3 +249,5 @@ props.groupComponent,

}, 0);
const availiableLabelCount = Math.floor((size * gridAndTicks.length) / labelsSumSize);
const availiableLabelCount = Math.floor(
(size * gridAndTicks.length) / labelsSumSize
);
const divider = Math.ceil(gridAndTicks.length / availiableLabelCount) || 1;

@@ -223,3 +257,6 @@ const getLabelCoord = (gridAndTick) =>

.filter(isVictoryLabel)
.reduce((prev, child) => (isVertical ? child.props.y : child.props.x) || 0, 0);
.reduce(
(prev, child) => (isVertical ? child.props.y : child.props.x) || 0,
0
);
const sorted = gridAndTicks.sort(

@@ -251,3 +288,7 @@ (a, b) =>

: gridAndTicks;
const children = [this.renderLine(props), this.renderLabel(props), ...modifiedGridAndTicks];
const children = [
this.renderLine(props),
this.renderLabel(props),
...modifiedGridAndTicks
];
return props.standalone

@@ -254,0 +295,0 @@ ? this.renderContainer(props.containerComponent, children)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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