Socket
Socket
Sign inDemoInstall

victory-polar-axis

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-polar-axis - npm Package Compare versions

Comparing version 35.8.1 to 35.9.0

4

es/helper-methods.js

@@ -96,2 +96,6 @@ import _defaults from "lodash/defaults";

var getStyles = function (props, styleObject) {
if (props.disableInlineStyles) {
return {};
}
var style = props.style || {};

@@ -98,0 +102,0 @@ styleObject = styleObject || {};

@@ -22,3 +22,8 @@ // Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>

export type VictoryPolarAxisTTargetType = "axis" | "axisLabel" | "grid" | "ticks" | "tickLabels";
export type VictoryPolarAxisTTargetType =
| "axis"
| "axisLabel"
| "grid"
| "ticks"
| "tickLabels";

@@ -35,3 +40,6 @@ export interface VictoryPolarAxisProps

endAngle?: number;
events?: EventPropTypeInterface<VictoryPolarAxisTTargetType, string | number>[];
events?: EventPropTypeInterface<
VictoryPolarAxisTTargetType,
string | number
>[];
gridComponent?: React.ReactElement;

@@ -44,2 +52,5 @@ innerRadius?: number;

export class VictoryPolarAxis extends React.Component<VictoryPolarAxisProps, any> {}
export class VictoryPolarAxis extends React.Component<
VictoryPolarAxisProps,
any
> {}

@@ -215,2 +215,3 @@ import _isEmpty from "lodash/isEmpty";

dependentAxis: PropTypes.bool,
disableInlineStyles: PropTypes.bool,
endAngle: PropTypes.number,

@@ -217,0 +218,0 @@ events: PropTypes.arrayOf(PropTypes.shape({

@@ -114,2 +114,6 @@ "use strict";

var getStyles = function (props, styleObject) {
if (props.disableInlineStyles) {
return {};
}
var style = props.style || {};

@@ -116,0 +120,0 @@ styleObject = styleObject || {};

@@ -22,3 +22,8 @@ // Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>

export type VictoryPolarAxisTTargetType = "axis" | "axisLabel" | "grid" | "ticks" | "tickLabels";
export type VictoryPolarAxisTTargetType =
| "axis"
| "axisLabel"
| "grid"
| "ticks"
| "tickLabels";

@@ -35,3 +40,6 @@ export interface VictoryPolarAxisProps

endAngle?: number;
events?: EventPropTypeInterface<VictoryPolarAxisTTargetType, string | number>[];
events?: EventPropTypeInterface<
VictoryPolarAxisTTargetType,
string | number
>[];
gridComponent?: React.ReactElement;

@@ -44,2 +52,5 @@ innerRadius?: number;

export class VictoryPolarAxis extends React.Component<VictoryPolarAxisProps, any> {}
export class VictoryPolarAxis extends React.Component<
VictoryPolarAxisProps,
any
> {}

@@ -231,2 +231,3 @@ "use strict";

dependentAxis: _propTypes.default.bool,
disableInlineStyles: _propTypes.default.bool,
endAngle: _propTypes.default.number,

@@ -233,0 +234,0 @@ events: _propTypes.default.arrayOf(_propTypes.default.shape({

4

package.json
{
"name": "victory-polar-axis",
"version": "35.8.1",
"version": "35.9.0",
"description": "Polar 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": {

@@ -30,4 +30,7 @@ import { assign, uniqBy, defaults } from "lodash";

const generalAxisStyle =
(theme.polarAxis && theme.polarAxis.style) || (theme.axis && theme.axis.style);
const polarAxisType = dependentAxis ? "polarDependentAxis" : "polarIndependentAxis";
(theme.polarAxis && theme.polarAxis.style) ||
(theme.axis && theme.axis.style);
const polarAxisType = dependentAxis
? "polarDependentAxis"
: "polarIndependentAxis";
const standardAxisType = dependentAxis ? "dependentAxis" : "independentAxis";

@@ -39,5 +42,16 @@ const specificAxisStyle =

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;

@@ -87,2 +101,5 @@ }, {});

const getStyles = (props, styleObject) => {
if (props.disableInlineStyles) {
return {};
}
const style = props.style || {};

@@ -136,7 +153,10 @@ styleObject = styleObject || {};

});
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const axisAngle =
axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const tickPadding = tickStyle.padding || tickStyle.size || 0;
const padAngle = Helpers.degreesToRadians(90 - axisAngle);
const tickAngle =
axisType === "angular" ? scale(tickValue) : Helpers.degreesToRadians(-1 * axisAngle);
axisType === "angular"
? scale(tickValue)
: Helpers.degreesToRadians(-1 * axisAngle);
const tickRadius = axisType === "angular" ? radius : scale(tickValue);

@@ -158,6 +178,18 @@

style: tickStyle,
x1: tickRadius * Math.cos(tickAngle) + Math.cos(padAngle) * tickPadding + origin.x,
x2: tickRadius * Math.cos(tickAngle) - Math.cos(padAngle) * tickPadding + origin.x,
y1: tickRadius * Math.sin(tickAngle) + Math.sin(padAngle) * tickPadding + origin.y,
y2: tickRadius * Math.sin(tickAngle) - Math.sin(padAngle) * tickPadding + origin.y
x1:
tickRadius * Math.cos(tickAngle) +
Math.cos(padAngle) * tickPadding +
origin.x,
x2:
tickRadius * Math.cos(tickAngle) -
Math.cos(padAngle) * tickPadding +
origin.x,
y1:
tickRadius * Math.sin(tickAngle) +
Math.sin(padAngle) * tickPadding +
origin.y,
y2:
tickRadius * Math.sin(tickAngle) -
Math.sin(padAngle) * tickPadding +
origin.y
};

@@ -198,3 +230,4 @@ };

const angularPadding = 0; // TODO: do some geometry
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const axisAngle =
axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const labelAngle =

@@ -206,8 +239,15 @@ axisType === "angular"

labelStyle.angle === undefined
? LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), labelAngle)
? LabelHelpers.getPolarAngle(
assign({}, props, { labelPlacement }),
labelAngle
)
: labelStyle.angle;
const labelRadius = axisType === "angular" ? radius + tickPadding : scale(tickValue);
const labelRadius =
axisType === "angular" ? radius + tickPadding : scale(tickValue);
const textAnchor =
labelStyle.textAnchor ||
LabelHelpers.getPolarTextAnchor(assign({}, props, { labelPlacement }), labelAngle);
LabelHelpers.getPolarTextAnchor(
assign({}, props, { labelPlacement }),
labelAngle
);
return {

@@ -285,6 +325,10 @@ index,

const labelStyle = (style && style.axisLabel) || {};
const axisAngle = axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const axisAngle =
axisType === "radial" ? getAxisAngle(props, scale) : undefined;
const textAngle =
labelStyle.angle === undefined
? LabelHelpers.getPolarAngle(assign({}, props, { labelPlacement }), axisAngle)
? LabelHelpers.getPolarAngle(
assign({}, props, { labelPlacement }),
axisAngle
)
: labelStyle.angle;

@@ -294,6 +338,12 @@ const labelRadius = radius + (labelStyle.padding || 0);

labelStyle.textAnchor ||
LabelHelpers.getTextPolarAnchor(assign({}, props, { labelPlacement }), axisAngle);
LabelHelpers.getTextPolarAnchor(
assign({}, props, { labelPlacement }),
axisAngle
);
const verticalAnchor =
labelStyle.verticalAnchor ||
LabelHelpers.getPolarVerticalAnchor(assign({}, props, { labelPlacement }), axisAngle);
LabelHelpers.getPolarVerticalAnchor(
assign({}, props, { labelPlacement }),
axisAngle
);
return {

@@ -305,4 +355,8 @@ style: labelStyle,

text: props.label,
x: getPosition(labelRadius, Helpers.degreesToRadians(axisAngle), "x") + origin.x,
y: getPosition(labelRadius, Helpers.degreesToRadians(axisAngle), "y") + origin.y
x:
getPosition(labelRadius, Helpers.degreesToRadians(axisAngle), "x") +
origin.x,
y:
getPosition(labelRadius, Helpers.degreesToRadians(axisAngle), "y") +
origin.y
};

@@ -348,3 +402,4 @@ };

const initialTicks = Axis.getTicks(props, scale);
const ticks = axisType === "angular" ? filterTicks(initialTicks, scale) : initialTicks;
const ticks =
axisType === "angular" ? filterTicks(initialTicks, scale) : initialTicks;
const tickFormat = Axis.getTickFormat(props, scale);

@@ -351,0 +406,0 @@ const radius = getRadius(props);

@@ -22,3 +22,8 @@ // Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>

export type VictoryPolarAxisTTargetType = "axis" | "axisLabel" | "grid" | "ticks" | "tickLabels";
export type VictoryPolarAxisTTargetType =
| "axis"
| "axisLabel"
| "grid"
| "ticks"
| "tickLabels";

@@ -35,3 +40,6 @@ export interface VictoryPolarAxisProps

endAngle?: number;
events?: EventPropTypeInterface<VictoryPolarAxisTTargetType, string | number>[];
events?: EventPropTypeInterface<
VictoryPolarAxisTTargetType,
string | number
>[];
gridComponent?: React.ReactElement;

@@ -44,2 +52,5 @@ innerRadius?: number;

export class VictoryPolarAxis extends React.Component<VictoryPolarAxisProps, any> {}
export class VictoryPolarAxis extends React.Component<
VictoryPolarAxisProps,
any
> {}

@@ -64,3 +64,7 @@ import React from "react";

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

@@ -77,9 +81,19 @@ PropTypes.arrayOf(PropTypes.string),

dependentAxis: PropTypes.bool,
disableInlineStyles: PropTypes.bool,
endAngle: PropTypes.number,
events: PropTypes.arrayOf(
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

@@ -108,3 +122,6 @@ ]),

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

@@ -149,3 +166,5 @@ tickValues: CustomPropTypes.homogeneousArray

const { dependentAxis } = props;
const axisComponent = dependentAxis ? props.axisComponent : props.circularAxisComponent;
const axisComponent = dependentAxis
? props.axisComponent
: props.circularAxisComponent;
const axisProps = this.getComponentProps(axisComponent, "axis", 0);

@@ -160,3 +179,7 @@ return React.cloneElement(axisComponent, axisProps);

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

@@ -170,7 +193,10 @@ }

const visible =
style.stroke !== "transparent" && style.stroke !== "none" && style.strokeWidth !== 0;
style.stroke !== "transparent" &&
style.stroke !== "none" &&
style.strokeWidth !== 0;
return visible || !isEmpty(events);
};
const axisType = props.dependentAxis ? "radial" : "angular";
const gridComponent = axisType === "radial" ? props.circularGridComponent : props.gridComponent;
const gridComponent =
axisType === "radial" ? props.circularGridComponent : props.gridComponent;
const tickComponents = this.dataKeys

@@ -235,3 +261,5 @@ .map((key, index) => {

const children = this.renderAxis(props);
return props.standalone ? this.renderContainer(props.containerComponent, children) : children;
return props.standalone
? this.renderContainer(props.containerComponent, children)
: children;
}

@@ -238,0 +266,0 @@ }

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