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

victory-box-plot

Package Overview
Dependencies
Maintainers
3
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-box-plot - npm Package Compare versions

Comparing version 35.8.1 to 35.9.0

30

es/helper-methods.js

@@ -169,2 +169,6 @@ import _isNil from "lodash/isNil";

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

@@ -241,3 +245,4 @@ styleObject = styleObject || {};

scale = props.scale,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions = props.positions,

@@ -269,3 +274,4 @@ min = _props$positions.min,

},
style: style[type] || style.whisker
style: disableInlineStyles ? {} : style[type] || style.whisker,
disableInlineStyles: disableInlineStyles
};

@@ -280,3 +286,4 @@ };

datum = props.datum,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions2 = props.positions,

@@ -300,3 +307,4 @@ median = _props$positions2.median,

height: horizontal ? boxWidth : defaultHeight,
style: style[type] || style.boxes
style: disableInlineStyles ? {} : style[type] || style.boxes,
disableInlineStyles: disableInlineStyles
};

@@ -311,3 +319,4 @@ };

scale = props.scale,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions3 = props.positions,

@@ -325,3 +334,4 @@ median = _props$positions3.median,

y2: horizontal ? y + boxWidth / 2 : median,
style: style.median
style: disableInlineStyles ? {} : style.median,
disableInlineStyles: disableInlineStyles
};

@@ -359,3 +369,4 @@ };

style = props.style,
theme = props.theme;
theme = props.theme,
disableInlineStyles = props.disableInlineStyles;
var orientation = getOrientation(labelOrientation, type);

@@ -392,3 +403,3 @@ var namespace = "".concat(type, "Labels");

orientation: orientation,
style: labelStyle,
style: disableInlineStyles ? {} : labelStyle,
y: horizontal ? positions.y : positions[type],

@@ -401,3 +412,4 @@ x: horizontal ? positions[type] : positions.x,

angle: labelStyle.angle,
horizontal: horizontal
horizontal: horizontal,
disableInlineStyles: disableInlineStyles
};

@@ -404,0 +416,0 @@ var component = props["".concat(type, "LabelComponent")];

@@ -42,3 +42,5 @@ import * as React from "react";

export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps {
export interface VictoryBoxPlotProps
extends VictoryCommonProps,
VictoryDatableProps {
boxWidth?: number;

@@ -45,0 +47,0 @@ domain?: DomainPropType;

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

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

@@ -262,3 +266,4 @@ styleObject = styleObject || {};

scale = props.scale,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions = props.positions,

@@ -290,3 +295,4 @@ min = _props$positions.min,

},
style: style[type] || style.whisker
style: disableInlineStyles ? {} : style[type] || style.whisker,
disableInlineStyles: disableInlineStyles
};

@@ -301,3 +307,4 @@ };

datum = props.datum,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions2 = props.positions,

@@ -321,3 +328,4 @@ median = _props$positions2.median,

height: horizontal ? boxWidth : defaultHeight,
style: style[type] || style.boxes
style: disableInlineStyles ? {} : style[type] || style.boxes,
disableInlineStyles: disableInlineStyles
};

@@ -332,3 +340,4 @@ };

scale = props.scale,
index = props.index;
index = props.index,
disableInlineStyles = props.disableInlineStyles;
var _props$positions3 = props.positions,

@@ -346,3 +355,4 @@ median = _props$positions3.median,

y2: horizontal ? y + boxWidth / 2 : median,
style: style.median
style: disableInlineStyles ? {} : style.median,
disableInlineStyles: disableInlineStyles
};

@@ -380,3 +390,4 @@ };

style = props.style,
theme = props.theme;
theme = props.theme,
disableInlineStyles = props.disableInlineStyles;
var orientation = getOrientation(labelOrientation, type);

@@ -413,3 +424,3 @@ var namespace = "".concat(type, "Labels");

orientation: orientation,
style: labelStyle,
style: disableInlineStyles ? {} : labelStyle,
y: horizontal ? positions.y : positions[type],

@@ -422,3 +433,4 @@ x: horizontal ? positions[type] : positions.x,

angle: labelStyle.angle,
horizontal: horizontal
horizontal: horizontal,
disableInlineStyles: disableInlineStyles
};

@@ -425,0 +437,0 @@ var component = props["".concat(type, "LabelComponent")];

@@ -42,3 +42,5 @@ import * as React from "react";

export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps {
export interface VictoryBoxPlotProps
extends VictoryCommonProps,
VictoryDatableProps {
boxWidth?: number;

@@ -45,0 +47,0 @@ domain?: DomainPropType;

{
"name": "victory-box-plot",
"version": "35.8.1",
"version": "35.9.0",
"description": "Box Plot Component for Victory",

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

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

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

@@ -1,2 +0,11 @@

import { orderBy, defaults, assign, uniq, groupBy, keys, isNaN, isNil } from "lodash";
import {
orderBy,
defaults,
assign,
uniq,
groupBy,
keys,
isNaN,
isNil
} from "lodash";
import { Helpers, Scale, Domain, Data, Collection } from "victory-core";

@@ -61,3 +70,5 @@ import { min as d3Min, max as d3Max, quantile as d3Quantile } from "d3-array";

return data.map((datum) => {
const dataArray = datum[sortKey].map((d) => assign({}, datum, { [sortKey]: d }));
const dataArray = datum[sortKey].map((d) =>
assign({}, datum, { [sortKey]: d })
);
const sortedData = orderBy(dataArray, sortKey);

@@ -152,6 +163,13 @@ return getSummaryStatistics(sortedData);

const getStyles = (props, styleObject) => {
if (props.disableInlineStyles) {
return {};
}
const style = props.style || {};
styleObject = styleObject || {};
const parentStyles = { height: "100%", width: "100%" };
const labelStyles = defaults({}, style.labels, getLabelStyle(props, styleObject));
const labelStyles = defaults(
{},
style.labels,
getLabelStyle(props, styleObject)
);
const boxStyles = defaults({}, style.boxes, styleObject.boxes);

@@ -164,3 +182,8 @@ const whiskerStyles = defaults({}, style.whiskers, styleObject.whiskers);

max: defaults({}, style.max, styleObject.max, whiskerStyles),
maxLabels: defaults({}, style.maxLabels, getLabelStyle(props, styleObject, "max"), labelStyles),
maxLabels: defaults(
{},
style.maxLabels,
getLabelStyle(props, styleObject, "max"),
labelStyles
),
median: defaults({}, style.median, styleObject.median, whiskerStyles),

@@ -174,7 +197,22 @@ medianLabels: defaults(

min: defaults({}, style.min, styleObject.min, whiskerStyles),
minLabels: defaults({}, style.minLabels, getLabelStyle(props, styleObject, "min"), labelStyles),
minLabels: defaults(
{},
style.minLabels,
getLabelStyle(props, styleObject, "min"),
labelStyles
),
q1: defaults({}, style.q1, styleObject.q1, boxStyles),
q1Labels: defaults({}, style.q1Labels, getLabelStyle(props, styleObject, "q1"), labelStyles),
q1Labels: defaults(
{},
style.q1Labels,
getLabelStyle(props, styleObject, "q1"),
labelStyles
),
q3: defaults({}, style.q3, styleObject.q3, boxStyles),
q3Labels: defaults({}, style.q3Labels, getLabelStyle(props, styleObject, "q3"), labelStyles),
q3Labels: defaults(
{},
style.q3Labels,
getLabelStyle(props, styleObject, "q3"),
labelStyles
),
whiskers: whiskerStyles

@@ -203,3 +241,4 @@ };

};
const defaultStyles = theme && theme.boxplot && theme.boxplot.style ? theme.boxplot.style : {};
const defaultStyles =
theme && theme.boxplot && theme.boxplot.style ? theme.boxplot.style : {};
const style = getStyles(props, defaultStyles);

@@ -214,3 +253,12 @@ const defaultOrientation = props.horizontal ? "top" : "right";

const getWhiskerProps = (props, type) => {
const { horizontal, style, boxWidth, whiskerWidth, datum, scale, index } = props;
const {
horizontal,
style,
boxWidth,
whiskerWidth,
datum,
scale,
index,
disableInlineStyles
} = props;
const { min, max, q1, q3, x, y } = props.positions;

@@ -236,3 +284,4 @@ const boxValue = type === "min" ? q1 : q3;

},
style: style[type] || style.whisker
style: disableInlineStyles ? {} : style[type] || style.whisker,
disableInlineStyles
};

@@ -242,3 +291,11 @@ };

const getBoxProps = (props, type) => {
const { horizontal, boxWidth, style, scale, datum, index } = props;
const {
horizontal,
boxWidth,
style,
scale,
datum,
index,
disableInlineStyles
} = props;
const { median, q1, q3, x, y } = props.positions;

@@ -257,3 +314,4 @@ const defaultX = type === "q1" ? q1 : median;

height: horizontal ? boxWidth : defaultHeight,
style: style[type] || style.boxes
style: disableInlineStyles ? {} : style[type] || style.boxes,
disableInlineStyles
};

@@ -263,3 +321,11 @@ };

const getMedianProps = (props) => {
const { boxWidth, horizontal, style, datum, scale, index } = props;
const {
boxWidth,
horizontal,
style,
datum,
scale,
index,
disableInlineStyles
} = props;
const { median, x, y } = props.positions;

@@ -274,3 +340,4 @@ return {

y2: horizontal ? y + boxWidth / 2 : median,
style: style.median
style: disableInlineStyles ? {} : style.median,
disableInlineStyles
};

@@ -293,12 +360,34 @@ };

const getOrientation = (labelOrientation, type) =>
(typeof labelOrientation === "object" && labelOrientation[type]) || labelOrientation;
(typeof labelOrientation === "object" && labelOrientation[type]) ||
labelOrientation;
const getLabelProps = (props, text, type) => {
const { datum, positions, index, boxWidth, horizontal, labelOrientation, style, theme } = props;
const {
datum,
positions,
index,
boxWidth,
horizontal,
labelOrientation,
style,
theme,
disableInlineStyles
} = props;
const orientation = getOrientation(labelOrientation, type);
const namespace = `${type}Labels`;
const labelStyle = style[namespace] || style.labels;
const defaultVerticalAnchors = { top: "end", bottom: "start", left: "middle", right: "middle" };
const defaultTextAnchors = { left: "end", right: "start", top: "middle", bottom: "middle" };
const whiskerWidth = typeof props.whiskerWidth === "number" ? props.whiskerWidth : boxWidth;
const defaultVerticalAnchors = {
top: "end",
bottom: "start",
left: "middle",
right: "middle"
};
const defaultTextAnchors = {
left: "end",
right: "start",
top: "middle",
bottom: "middle"
};
const whiskerWidth =
typeof props.whiskerWidth === "number" ? props.whiskerWidth : boxWidth;
const width = type === "min" || type === "max" ? whiskerWidth : boxWidth;

@@ -319,3 +408,3 @@

orientation,
style: labelStyle,
style: disableInlineStyles ? {} : labelStyle,
y: horizontal ? positions.y : positions[type],

@@ -326,5 +415,7 @@ x: horizontal ? positions[type] : positions.x,

textAnchor: labelStyle.textAnchor || defaultTextAnchors[orientation],
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[orientation],
verticalAnchor:
labelStyle.verticalAnchor || defaultVerticalAnchors[orientation],
angle: labelStyle.angle,
horizontal
horizontal,
disableInlineStyles
};

@@ -370,3 +461,6 @@

// if min/max are out of the bounds of the domain
if ((isUnderMinY(_min) && isUnderMinY(_max)) || (isOverMaxY(_min) && isOverMaxY(_max)))
if (
(isUnderMinY(_min) && isUnderMinY(_max)) ||
(isOverMaxY(_min) && isOverMaxY(_max))
)
yOutOfBounds = true;

@@ -443,3 +537,7 @@

const target = `${type}Labels`;
acc[eventKey][target] = getLabelProps(assign({}, props, dataProps), labelText, type);
acc[eventKey][target] = getLabelProps(
assign({}, props, dataProps),
labelText,
type
);
}

@@ -446,0 +544,0 @@ });

@@ -42,3 +42,5 @@ import * as React from "react";

export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps {
export interface VictoryBoxPlotProps
extends VictoryCommonProps,
VictoryDatableProps {
boxWidth?: number;

@@ -45,0 +47,0 @@ domain?: DomainPropType;

@@ -52,3 +52,10 @@ import React from "react";

class VictoryBoxPlot extends React.Component {
static animationWhitelist = ["data", "domain", "height", "padding", "style", "width"];
static animationWhitelist = [
"data",
"domain",
"height",
"padding",
"style",
"width"
];

@@ -79,3 +86,6 @@ static displayName = "VictoryBoxPlot";

PropTypes.array,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string

@@ -100,3 +110,6 @@ ]),

PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string,

@@ -107,6 +120,13 @@ PropTypes.arrayOf(PropTypes.string)

maxLabelComponent: PropTypes.element,
maxLabels: PropTypes.oneOfType([PropTypes.func, PropTypes.array, PropTypes.bool]),
maxLabels: PropTypes.oneOfType([
PropTypes.func,
PropTypes.array,
PropTypes.bool
]),
median: PropTypes.oneOfType([
PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string,

@@ -117,6 +137,13 @@ PropTypes.arrayOf(PropTypes.string)

medianLabelComponent: PropTypes.element,
medianLabels: PropTypes.oneOfType([PropTypes.func, PropTypes.array, PropTypes.bool]),
medianLabels: PropTypes.oneOfType([
PropTypes.func,
PropTypes.array,
PropTypes.bool
]),
min: PropTypes.oneOfType([
PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string,

@@ -127,6 +154,13 @@ PropTypes.arrayOf(PropTypes.string)

minLabelComponent: PropTypes.element,
minLabels: PropTypes.oneOfType([PropTypes.func, PropTypes.array, PropTypes.bool]),
minLabels: PropTypes.oneOfType([
PropTypes.func,
PropTypes.array,
PropTypes.bool
]),
q1: PropTypes.oneOfType([
PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string,

@@ -137,6 +171,13 @@ PropTypes.arrayOf(PropTypes.string)

q1LabelComponent: PropTypes.element,
q1Labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array, PropTypes.bool]),
q1Labels: PropTypes.oneOfType([
PropTypes.func,
PropTypes.array,
PropTypes.bool
]),
q3: PropTypes.oneOfType([
PropTypes.func,
CustomPropTypes.allOfType([CustomPropTypes.integer, CustomPropTypes.nonNegative]),
CustomPropTypes.allOfType([
CustomPropTypes.integer,
CustomPropTypes.nonNegative
]),
PropTypes.string,

@@ -147,3 +188,7 @@ PropTypes.arrayOf(PropTypes.string)

q3LabelComponent: PropTypes.element,
q3Labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array, PropTypes.bool]),
q3Labels: PropTypes.oneOfType([
PropTypes.func,
PropTypes.array,
PropTypes.bool
]),
style: PropTypes.shape({

@@ -214,5 +259,11 @@ boxes: PropTypes.object,

const baseComponent = props[`${type}Component`];
const componentProps = this.getComponentProps(baseComponent, type, index);
const componentProps = this.getComponentProps(
baseComponent,
type,
index
);
if (this.shouldRenderDatum(componentProps.datum)) {
validDataComponents.push(React.cloneElement(baseComponent, componentProps));
validDataComponents.push(
React.cloneElement(baseComponent, componentProps)
);
}

@@ -269,3 +320,5 @@ return validDataComponents;

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

@@ -272,0 +325,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