Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

victory-axis

Package Overview
Dependencies
Maintainers
35
Versions
169
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 31.2.0 to 32.0.0

47

es/helper-methods.js

@@ -38,10 +38,29 @@ import _isFunction from "lodash/isFunction";

}, {});
}; // exposed for use by VictoryChart
};
var getCurrentAxis = function (props, axis) {
var orientation = props.orientation,
horizontal = props.horizontal;
if (orientation) {
var dimensions = {
top: "x",
bottom: "x",
left: "y",
right: "y"
};
return dimensions[orientation];
}
var otherAxis = axis === "x" ? "y" : "x";
return horizontal ? otherAxis : axis;
};
var getScale = function (props) {
var axis = Axis.getAxis(props);
var currentAxis = getCurrentAxis(props, axis);
var scale = Scale.getBaseScale(props, axis);
var domain = Axis.getDomain(props) || scale.domain();
scale.range(Helpers.getRange(props, axis));
var propsDomain = props.domain && props.domain[axis];
var domain = propsDomain || Axis.getDomain(props) || scale.domain();
scale.range(Helpers.getRange(props, currentAxis));
scale.domain(domain);

@@ -341,2 +360,14 @@ return scale;

var getOrientation = function (props) {
if (props.orientation) {
return props.orientation;
}
var defaultOrientations = {
dependent: props.horizontal ? "bottom" : "left",
independent: props.horizontal ? "left" : "bottom"
};
return props.dependentAxis ? defaultOrientations.dependent : defaultOrientations.independent;
};
var getCalculatedValues = function (props) {

@@ -346,3 +377,2 @@ var defaultStyles = getStyleObject(props);

var padding = Helpers.getPadding(props);
var orientation = props.orientation || (props.dependentAxis ? "left" : "bottom");
var isVertical = Axis.isVertical(props);

@@ -352,2 +382,3 @@ var labelPadding = getLabelPadding(props, style);

var axis = Axis.getAxis(props);
var orientation = getOrientation(props);
var scale = getScale(props);

@@ -396,3 +427,4 @@ var domain = Axis.getDomain(props);

polar = _props.polar,
padding = _props.padding;
padding = _props.padding,
horizontal = _props.horizontal;

@@ -406,3 +438,4 @@ var _getLayoutProps = getLayoutProps(props, calculatedValues),

scale: _defineProperty({}, axis, scale),
polar: polar
polar: polar,
horizontal: horizontal
};

@@ -456,2 +489,2 @@ var axisProps = getAxisProps(props, calculatedValues, globalTransform);

export { getBaseProps, getScale, getStyles };
export { getBaseProps, getStyles };

9

es/victory-axis.js

@@ -30,3 +30,3 @@ import _assign from "lodash/assign";

import { PropTypes as CustomPropTypes, Helpers, VictoryLabel, CommonProps, VictoryContainer, VictoryTheme, LineSegment, TextSize, addEvents, Axis } from "victory-core";
import { getBaseProps, getScale, getStyles } from "./helper-methods";
import { getBaseProps, getStyles } from "./helper-methods";
var fallbackProps = {

@@ -294,3 +294,2 @@ width: 450,

}),
scale: "linear",
standalone: true,

@@ -317,8 +316,2 @@ theme: VictoryTheme.grayscale,

});
Object.defineProperty(VictoryAxis, "getScale", {
configurable: true,
enumerable: true,
writable: true,
value: getScale
});
Object.defineProperty(VictoryAxis, "getStyles", {

@@ -325,0 +318,0 @@ configurable: true,

@@ -6,3 +6,3 @@ "use strict";

});
exports.getStyles = exports.getScale = exports.getBaseProps = void 0;
exports.getStyles = exports.getBaseProps = void 0;

@@ -51,12 +51,32 @@ var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));

}, {});
}; // exposed for use by VictoryChart
};
var getCurrentAxis = function (props, axis) {
var orientation = props.orientation,
horizontal = props.horizontal;
if (orientation) {
var dimensions = {
top: "x",
bottom: "x",
left: "y",
right: "y"
};
return dimensions[orientation];
}
var otherAxis = axis === "x" ? "y" : "x";
return horizontal ? otherAxis : axis;
};
var getScale = function (props) {
var axis = _victoryCore.Axis.getAxis(props);
var currentAxis = getCurrentAxis(props, axis);
var scale = _victoryCore.Scale.getBaseScale(props, axis);
var domain = _victoryCore.Axis.getDomain(props) || scale.domain();
scale.range(_victoryCore.Helpers.getRange(props, axis));
var propsDomain = props.domain && props.domain[axis];
var domain = propsDomain || _victoryCore.Axis.getDomain(props) || scale.domain();
scale.range(_victoryCore.Helpers.getRange(props, currentAxis));
scale.domain(domain);

@@ -66,4 +86,2 @@ return scale;

exports.getScale = getScale;
var getStyleObject = function (props) {

@@ -364,2 +382,14 @@ var theme = props.theme,

var getOrientation = function (props) {
if (props.orientation) {
return props.orientation;
}
var defaultOrientations = {
dependent: props.horizontal ? "bottom" : "left",
independent: props.horizontal ? "left" : "bottom"
};
return props.dependentAxis ? defaultOrientations.dependent : defaultOrientations.independent;
};
var getCalculatedValues = function (props) {

@@ -371,4 +401,2 @@ var defaultStyles = getStyleObject(props);

var orientation = props.orientation || (props.dependentAxis ? "left" : "bottom");
var isVertical = _victoryCore.Axis.isVertical(props);

@@ -381,2 +409,3 @@

var orientation = getOrientation(props);
var scale = getScale(props);

@@ -429,3 +458,4 @@

polar = _props.polar,
padding = _props.padding;
padding = _props.padding,
horizontal = _props.horizontal;

@@ -439,3 +469,4 @@ var _getLayoutProps = getLayoutProps(props, calculatedValues),

scale: _defineProperty({}, axis, scale),
polar: polar
polar: polar,
horizontal: horizontal
};

@@ -442,0 +473,0 @@ var axisProps = getAxisProps(props, calculatedValues, globalTransform);

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

}),
scale: "linear",
standalone: true,

@@ -334,8 +333,2 @@ theme: _victoryCore.VictoryTheme.grayscale,

});
Object.defineProperty(VictoryAxis, "getScale", {
configurable: true,
enumerable: true,
writable: true,
value: _helperMethods.getScale
});
Object.defineProperty(VictoryAxis, "getStyles", {

@@ -342,0 +335,0 @@ configurable: true,

{
"name": "victory-axis",
"version": "31.2.0",
"version": "32.0.0",
"description": "Axis Component for Victory",

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

"prop-types": "^15.5.8",
"victory-core": "^31.2.0"
"victory-core": "^32.0.0"
},

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

@@ -25,8 +25,19 @@ import { assign, defaults, isFunction } from "lodash";

// exposed for use by VictoryChart
const getCurrentAxis = (props, axis) => {
const { orientation, horizontal } = props;
if (orientation) {
const dimensions = { top: "x", bottom: "x", left: "y", right: "y" };
return dimensions[orientation];
}
const otherAxis = axis === "x" ? "y" : "x";
return horizontal ? otherAxis : axis;
};
const getScale = (props) => {
const axis = Axis.getAxis(props);
const currentAxis = getCurrentAxis(props, axis);
const scale = Scale.getBaseScale(props, axis);
const domain = Axis.getDomain(props) || scale.domain();
scale.range(Helpers.getRange(props, axis));
const propsDomain = props.domain && props.domain[axis];
const domain = propsDomain || Axis.getDomain(props) || scale.domain();
scale.range(Helpers.getRange(props, currentAxis));
scale.domain(domain);

@@ -301,2 +312,13 @@ return scale;

const getOrientation = (props) => {
if (props.orientation) {
return props.orientation;
}
const defaultOrientations = {
dependent: props.horizontal ? "bottom" : "left",
independent: props.horizontal ? "left" : "bottom"
};
return props.dependentAxis ? defaultOrientations.dependent : defaultOrientations.independent;
};
const getCalculatedValues = (props) => {

@@ -306,3 +328,2 @@ const defaultStyles = getStyleObject(props);

const padding = Helpers.getPadding(props);
const orientation = props.orientation || (props.dependentAxis ? "left" : "bottom");
const isVertical = Axis.isVertical(props);

@@ -312,2 +333,3 @@ const labelPadding = getLabelPadding(props, style);

const axis = Axis.getAxis(props);
const orientation = getOrientation(props);
const scale = getScale(props);

@@ -353,5 +375,5 @@ const domain = Axis.getDomain(props);

const otherAxis = axis === "x" ? "y" : "x";
const { width, height, standalone, theme, polar, padding } = props;
const { width, height, standalone, theme, polar, padding, horizontal } = props;
const { globalTransform, gridOffset, gridEdge } = getLayoutProps(props, calculatedValues);
const sharedProps = { scale: { [axis]: scale }, polar };
const sharedProps = { scale: { [axis]: scale }, polar, horizontal };
const axisProps = getAxisProps(props, calculatedValues, globalTransform);

@@ -407,2 +429,2 @@ const axisLabelProps = getAxisLabelProps(props, calculatedValues, globalTransform);

export { getBaseProps, getScale, getStyles };
export { getBaseProps, getStyles };

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

} from "victory-core";
import { getBaseProps, getScale, getStyles } from "./helper-methods";
import { getBaseProps, getStyles } from "./helper-methods";

@@ -122,3 +122,2 @@ const fallbackProps = {

gridComponent: <LineSegment type={"grid"} />,
scale: "linear",
standalone: true,

@@ -133,3 +132,2 @@ theme: VictoryTheme.grayscale,

static getAxis = Axis.getAxis;
static getScale = getScale;
static getStyles = (props) => getStyles(props, fallbackProps.style);

@@ -136,0 +134,0 @@ static getBaseProps = (props) => getBaseProps(props, fallbackProps);

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