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

victory-errorbar

Package Overview
Dependencies
Maintainers
2
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-errorbar - npm Package Compare versions

Comparing version 31.0.2 to 31.1.0

10

es/victory-errorbar.js

@@ -48,3 +48,2 @@ 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; }

}];
var animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"];

@@ -71,3 +70,4 @@ var VictoryErrorBar =

value: function render() {
var role = this.constructor.role;
var animationWhitelist = VictoryErrorBar.animationWhitelist,
role = VictoryErrorBar.role;
var props = Helpers.modifyProps(this.props, fallbackProps, role);

@@ -87,2 +87,8 @@

Object.defineProperty(VictoryErrorBar, "animationWhitelist", {
configurable: true,
enumerable: true,
writable: true,
value: ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"]
});
Object.defineProperty(VictoryErrorBar, "displayName", {

@@ -89,0 +95,0 @@ configurable: true,

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

}];
var animationWhitelist = ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"];

@@ -85,3 +84,4 @@ var VictoryErrorBar =

value: function render() {
var role = this.constructor.role;
var animationWhitelist = VictoryErrorBar.animationWhitelist,
role = VictoryErrorBar.role;

@@ -102,2 +102,8 @@ var props = _victoryCore.Helpers.modifyProps(this.props, fallbackProps, role);

Object.defineProperty(VictoryErrorBar, "animationWhitelist", {
configurable: true,
enumerable: true,
writable: true,
value: ["data", "domain", "height", "padding", "samples", "style", "width", "errorX", "errorY", "borderWidth"]
});
Object.defineProperty(VictoryErrorBar, "displayName", {

@@ -104,0 +110,0 @@ configurable: true,

4

package.json
{
"name": "victory-errorbar",
"version": "31.0.2",
"version": "31.1.0",
"description": "Error Bar 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 @@

# VictoryErrorBar

@@ -104,3 +103,3 @@

*default:* `<ErrorBar/>`
_default:_ `<ErrorBar/>`

@@ -130,2 +129,3 @@ ```jsx

```
### errorX

@@ -139,17 +139,16 @@

*examples:* `errorX="uncertainty"`
_examples:_ `errorX="uncertainty"`
**function:** use a function to translate each element in a data array into a errorX value
*examples:* `errorX={() => 10}`
_examples:_ `errorX={() => 10}`
**array index:** specify which index of an array should be used as a errorX value when data is given as an array of arrays
*examples:* `errorX={1}`
_examples:_ `errorX={1}`
**path string or path array:** specify which property in an array of nested data objects should be used as a errorX value
*examples:* `errorX="measurement.uncertainty"`, `errorX={["measurement", "uncertainty"]}`
_examples:_ `errorX="measurement.uncertainty"`, `errorX={["measurement", "uncertainty"]}`
### errorY

@@ -163,15 +162,15 @@

*examples:* `errorY="uncertainty"`
_examples:_ `errorY="uncertainty"`
**function:** use a function to translate each element in a data array into a errorY value
*examples:* `errorY={() => 10}`
_examples:_ `errorY={() => 10}`
**array index:** specify which index of an array should be used as a errorY value when data is given as an array of arrays
*examples:* `errorY={1}`
_examples:_ `errorY={1}`
**path string or path array:** specify which property in an array of nested data objects should be used as a errorY value
*examples:* `errorY="measurement.uncertainty"`, `errorY={["measurement", "uncertainty"]}`
_examples:_ `errorY="measurement.uncertainty"`, `errorY={["measurement", "uncertainty"]}`

@@ -185,3 +184,3 @@ ### eventKey

```jsx
eventKey="x"
eventKey = "x";
```

@@ -237,3 +236,3 @@

*default:* `<g/>`
_default:_ `<g/>`

@@ -250,3 +249,3 @@ ```jsx

*default (provided by default theme):* `height={300}`
_default (provided by default theme):_ `height={300}`

@@ -263,3 +262,3 @@ ```jsx

*default:* `<VictoryLabel/>`
_default:_ `<VictoryLabel/>`

@@ -293,3 +292,2 @@ ```playground

```playground

@@ -307,3 +305,2 @@ <VictoryChart maxDomain={8}>

```playground

@@ -322,3 +319,3 @@ <VictoryChart minDomain={0}>

```jsx
name="series-1"
name = "series-1";
```

@@ -334,3 +331,2 @@

### padding

@@ -342,3 +338,3 @@

*default (provided by default theme):* `padding={50}`
_default (provided by default theme):_ `padding={50}`

@@ -371,3 +367,3 @@ ```jsx

*default:* `samples={50}`
_default:_ `samples={50}`

@@ -385,3 +381,3 @@ ```jsx

*default:* `scale="linear"`
_default:_ `scale="linear"`

@@ -411,3 +407,3 @@ ```jsx

```jsx
sortKey="x"
sortKey = "x";
```

@@ -421,3 +417,3 @@

*default:* `sortOrder="ascending"`
_default:_ `sortOrder="ascending"`

@@ -432,3 +428,3 @@ ### standalone

*default:* `standalone={true}`
_default:_ `standalone={true}`

@@ -452,3 +448,3 @@ ```playground

*default (provided by default theme):* See [grayscale theme][] for more detail
_default (provided by default theme):_ See [grayscale theme][] for more detail

@@ -478,3 +474,3 @@ ```playground

*default:* `theme={VictoryTheme.grayscale}`
_default:_ `theme={VictoryTheme.grayscale}`

@@ -491,3 +487,3 @@ ```jsx

*default (provided by default theme):* `width={450}`
_default (provided by default theme):_ `width={450}`

@@ -522,11 +518,11 @@ ```jsx

[Animations Guide]: https://formidable.com/open-source/victory/guides/animations
[Data Accessors Guide]: https://formidable.com/open-source/victory/guides/data-accessors
[Custom Components Guide]: https://formidable.com/open-source/victory/guides/custom-components
[Events Guide]: https://formidable.com/open-source/victory/guides/events
[Themes Guide]: https://formidable.com/open-source/victory/guides/themes
[animations guide]: https://formidable.com/open-source/victory/guides/animations
[data accessors guide]: https://formidable.com/open-source/victory/guides/data-accessors
[custom components guide]: https://formidable.com/open-source/victory/guides/custom-components
[events guide]: https://formidable.com/open-source/victory/guides/events
[themes guide]: https://formidable.com/open-source/victory/guides/themes
[`x`]: https://formidable.com/open-source/victory/docs/victory-candlestick#x
[`y`]: https://formidable.com/open-source/victory/docs/victory-candlestick#y
[`errorX`]: https://formidable.com/open-source/victory/docs/victory-candlestick#errorX
[`errorY`]: https://formidable.com/open-source/victory/docs/victory-candlestick#errorY
[`errorx`]: https://formidable.com/open-source/victory/docs/victory-candlestick#errorX
[`errory`]: https://formidable.com/open-source/victory/docs/victory-candlestick#errorY
[grayscale theme]: https://github.com/FormidableLabs/victory-core/blob/master/src/victory-theme/grayscale.js

@@ -12,12 +12,4 @@ /* eslint-disable max-statements */

datum: PropTypes.object,
errorX: PropTypes.oneOfType([
PropTypes.number,
PropTypes.array,
PropTypes.bool
]),
errorY: PropTypes.oneOfType([
PropTypes.number,
PropTypes.array,
PropTypes.bool
]),
errorX: PropTypes.oneOfType([PropTypes.number, PropTypes.array, PropTypes.bool]),
errorY: PropTypes.oneOfType([PropTypes.number, PropTypes.array, PropTypes.bool]),
groupComponent: PropTypes.element,

@@ -30,5 +22,5 @@ lineComponent: PropTypes.element,

static defaultProps = {
groupComponent: <g/>,
lineComponent: <Line/>
}
groupComponent: <g />,
lineComponent: <Line />
};

@@ -42,8 +34,22 @@ getStyle(props) {

const {
x, y, borderWidth, events, style, role, shapeRendering,
className, lineComponent, transform, id
x,
y,
borderWidth,
events,
style,
role,
shapeRendering,
className,
lineComponent,
transform,
id
} = props;
const vertical = type === "right" || type === "left";
const borderProps = {
role, shapeRendering, className, events, style, transform,
role,
shapeRendering,
className,
events,
style,
transform,
key: `${id}-border-${type}`,

@@ -60,7 +66,21 @@ x1: vertical ? error[type] : x - borderWidth,

const {
x, y, events, style, role, shapeRendering, className, lineComponent, transform, id
x,
y,
events,
style,
role,
shapeRendering,
className,
lineComponent,
transform,
id
} = props;
const vertical = type === "top" || type === "bottom";
const borderProps = {
role, shapeRendering, className, events, style, transform,
role,
shapeRendering,
className,
events,
style,
transform,
key: `${id}-cross-${type}`,

@@ -67,0 +87,0 @@ x1: x,

@@ -17,9 +17,10 @@ import { Helpers, LabelHelpers, Scale, Domain, Data, Collection } from "victory-core";

return Array.isArray(errors) ?
[ errors[0] === 0 ? false : scale[axis](errors[0] + datum[`_${axis}`]),
errors[1] === 0 ? false : scale[axis](datum[`_${axis}`] - errors[1]) ] :
[ scale[axis](errors + datum[`_${axis}`]), scale[axis](datum[`_${axis}`] - errors) ];
return Array.isArray(errors)
? [
errors[0] === 0 ? false : scale[axis](errors[0] + datum[`_${axis}`]),
errors[1] === 0 ? false : scale[axis](datum[`_${axis}`] - errors[1])
]
: [scale[axis](errors + datum[`_${axis}`]), scale[axis](datum[`_${axis}`] - errors)];
};
const getData = (props) => {

@@ -52,7 +53,7 @@ const accessorTypes = ["x", "y", "errorX", "errorY"];

return dataset.reduce((memo, datum) => {
const currentError = Array.isArray(datum[error]) ?
datum[error][errorIndex] : datum[error];
const currentError = Array.isArray(datum[error]) ? datum[error][errorIndex] : datum[error];
const current = datum[`_${currentAxis}`] + sign * (currentError || 0);
return (memo < current && type === "min") || (memo > current && type === "max") ?
memo : current;
return (memo < current && type === "min") || (memo > current && type === "max")
? memo
: current;
}, baseCondition);

@@ -71,4 +72,6 @@ };

const getCalculatedValues = (props) => {
const defaultStyles = props.theme && props.theme.errorbar && props.theme.errorbar.style ?
props.theme.errorbar.style : {};
const defaultStyles =
props.theme && props.theme.errorbar && props.theme.errorbar.style
? props.theme.errorbar.style
: {};
const style = Helpers.getStyles(props.style, defaultStyles) || {};

@@ -85,4 +88,8 @@ const data = getData(props);

const scale = {
x: Scale.getBaseScale(props, "x").domain(domain.x).range(range.x),
y: Scale.getBaseScale(props, "y").domain(domain.y).range(range.y)
x: Scale.getBaseScale(props, "x")
.domain(domain.x)
.range(range.x),
y: Scale.getBaseScale(props, "y")
.domain(domain.y)
.range(range.y)
};

@@ -117,9 +124,31 @@ const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;

const {
groupComponent, height, width, borderWidth, standalone, theme, polar, padding,
labels, events, sharedEvents, name
groupComponent,
height,
width,
borderWidth,
standalone,
theme,
polar,
padding,
labels,
events,
sharedEvents,
name
} = props;
const initialChildProps = { parent: {
domain, scale, data, height, width, standalone, theme, polar, origin, name,
padding, style: style.parent
} };
const initialChildProps = {
parent: {
domain,
scale,
data,
height,
width,
standalone,
theme,
polar,
origin,
name,
padding,
style: style.parent
}
};

@@ -132,3 +161,10 @@ return data.reduce((childProps, datum, index) => {

const dataProps = {
x, y, scale, datum, data, index, groupComponent, borderWidth,
x,
y,
scale,
datum,
data,
index,
groupComponent,
borderWidth,
style: style.data,

@@ -143,3 +179,3 @@ errorX: getErrors(datum, scale, "x"),

const text = LabelHelpers.getText(props, datum, index);
if (text !== undefined && text !== null || (labels && (events || sharedEvents))) {
if ((text !== undefined && text !== null) || (labels && (events || sharedEvents))) {
childProps[eventKey].labels = getLabelProps(dataProps, text, style);

@@ -146,0 +182,0 @@ }

import PropTypes from "prop-types";
import React from "react";
import {
PropTypes as CustomPropTypes, Helpers, VictoryLabel, addEvents,
VictoryContainer, VictoryTheme, DefaultTransitions, CommonProps
PropTypes as CustomPropTypes,
Helpers,
VictoryLabel,
addEvents,
VictoryContainer,
VictoryTheme,
DefaultTransitions,
CommonProps
} from "victory-core";

@@ -23,8 +29,16 @@ import ErrorBar from "./error-bar";

const animationWhitelist = [
"data", "domain", "height", "padding", "samples",
"style", "width", "errorX", "errorY", "borderWidth"
];
class VictoryErrorBar extends React.Component {
static animationWhitelist = [
"data",
"domain",
"height",
"padding",
"samples",
"style",
"width",
"errorX",
"errorY",
"borderWidth"
];
class VictoryErrorBar extends React.Component {
static displayName = "VictoryErrorBar";

@@ -54,7 +68,7 @@ static role = "errorbar";

static defaultProps = {
containerComponent: <VictoryContainer/>,
containerComponent: <VictoryContainer />,
data: defaultData,
dataComponent: <ErrorBar/>,
labelComponent: <VictoryLabel/>,
groupComponent: <g role="presentation"/>,
dataComponent: <ErrorBar />,
labelComponent: <VictoryLabel />,
groupComponent: <g role="presentation" />,
samples: 50,

@@ -71,3 +85,6 @@ scale: "linear",

static expectedComponents = [
"dataComponent", "labelComponent", "groupComponent", "containerComponent"
"dataComponent",
"labelComponent",
"groupComponent",
"containerComponent"
];

@@ -81,7 +98,9 @@

render() {
const { role } = this.constructor;
const { animationWhitelist, role } = VictoryErrorBar;
const props = Helpers.modifyProps(this.props, fallbackProps, role);
if (this.shouldAnimate()) {
return this.animateComponent(props, animationWhitelist);
}
const children = this.renderData(props);

@@ -88,0 +107,0 @@ return props.standalone ? this.renderContainer(props.containerComponent, children) : 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