Comparing version 0.0.198 to 0.0.199
@@ -129,4 +129,5 @@ import _pt from "prop-types"; | ||
boxplot.container.y1 = Math.min.apply(Math, valueRange); | ||
} | ||
} // eslint-disable-next-line react/jsx-no-useless-fragment | ||
if (children) return /*#__PURE__*/React.createElement(React.Fragment, null, children(boxplot)); | ||
@@ -133,0 +134,0 @@ return /*#__PURE__*/React.createElement(Group, { |
@@ -11,2 +11,11 @@ import _pt from "prop-types"; | ||
import { line, curveCardinal } from 'd3-shape'; | ||
var defaultCountAccessor = function defaultCountAccessor(d) { | ||
return typeof d.count === 'number' ? d.count : 0; | ||
}; | ||
var defaultValueAccessor = function defaultValueAccessor(d) { | ||
return typeof d.value === 'number' ? d.value : 0; | ||
}; | ||
export default function ViolinPlot(_ref) { | ||
@@ -22,9 +31,5 @@ var _ref$left = _ref.left, | ||
_ref$count = _ref.count, | ||
count = _ref$count === void 0 ? function (d) { | ||
return d && d.count || 0; | ||
} : _ref$count, | ||
count = _ref$count === void 0 ? defaultCountAccessor : _ref$count, | ||
_ref$value = _ref.value, | ||
value = _ref$value === void 0 ? function (d) { | ||
return d && d.value || 0; | ||
} : _ref$value, | ||
value = _ref$value === void 0 ? defaultValueAccessor : _ref$value, | ||
valueScale = _ref.valueScale, | ||
@@ -40,3 +45,4 @@ horizontal = _ref.horizontal, | ||
var widthScale = scaleLinear({ | ||
rangeRound: [0, width / 2], | ||
range: [0, width / 2], | ||
round: true, | ||
domain: [0, Math.max.apply(Math, binCounts)] | ||
@@ -74,4 +80,5 @@ }); | ||
path = rightCurvePath + " " + leftCurvePath.replace('M', 'L') + " Z"; | ||
} | ||
} // eslint-disable-next-line react/jsx-no-useless-fragment | ||
if (children) return /*#__PURE__*/React.createElement(React.Fragment, null, children({ | ||
@@ -78,0 +85,0 @@ path: path |
import React from 'react'; | ||
import { SharedProps, ChildRenderProps, GenericScale } from './types'; | ||
declare type ScaleInput = number; | ||
import { PickD3Scale, ContinuousDomainScaleType } from '@vx/scale'; | ||
import { SharedProps, ChildRenderProps } from './types'; | ||
export declare type BoxPlotProps = SharedProps & { | ||
/** Scale for converting ScaleInput values to pixel offsets. */ | ||
valueScale: GenericScale<ScaleInput>; | ||
/** Scale for converting input values to pixel offsets. */ | ||
valueScale: PickD3Scale<ContinuousDomainScaleType, number>; | ||
/** Maximum BoxPlot value. */ | ||
@@ -32,3 +32,3 @@ max?: number; | ||
/** Array of outlier values to be rendered. */ | ||
outliers?: ScaleInput[]; | ||
outliers?: number[]; | ||
/** Props to pass to the median glyph line. */ | ||
@@ -52,2 +52,2 @@ medianProps?: React.SVGProps<SVGLineElement>; | ||
export default function BoxPlot({ left, top, className, max, min, firstQuartile, thirdQuartile, median, boxWidth, fill, fillOpacity, stroke, strokeWidth, rx, ry, valueScale, outliers, horizontal, medianProps, maxProps, minProps, boxProps, outlierProps, container, containerProps, children, }: BoxPlotProps): JSX.Element; | ||
export {}; | ||
//# sourceMappingURL=BoxPlot.d.ts.map |
@@ -138,4 +138,5 @@ "use strict"; | ||
boxplot.container.y1 = Math.min.apply(Math, valueRange); | ||
} | ||
} // eslint-disable-next-line react/jsx-no-useless-fragment | ||
if (children) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(boxplot)); | ||
@@ -142,0 +143,0 @@ return /*#__PURE__*/_react.default.createElement(_group.Group, { |
export { default as BoxPlot } from './BoxPlot'; | ||
export { default as ViolinPlot } from './ViolinPlot'; | ||
export { default as computeStats } from './util/computeStats'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -43,6 +43,2 @@ export interface BoxPlot { | ||
}; | ||
export interface GenericScale<ScaleInput> { | ||
(input: ScaleInput): number; | ||
range(): number[] | [number, number]; | ||
} | ||
export declare type SharedProps = { | ||
@@ -58,1 +54,2 @@ /** Left pixel offset of the glyph. */ | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -6,1 +6,2 @@ import { BoxPlot, BinDatum } from '../types'; | ||
}; | ||
//# sourceMappingURL=computeStats.d.ts.map |
import React from 'react'; | ||
import { BinDatum, SharedProps, GenericScale } from './types'; | ||
export declare type ViolinPlotProps<ScaleInput> = SharedProps & { | ||
import { PickD3Scale, ContinuousDomainScaleType } from '@vx/scale'; | ||
import { SharedProps } from './types'; | ||
export declare type ViolinPlotProps<Datum extends object> = SharedProps & { | ||
/** Scale for converting values to pixel offsets. */ | ||
valueScale: GenericScale<number>; | ||
valueScale: PickD3Scale<ContinuousDomainScaleType, number>; | ||
/** Data used to draw the violin plot glyph. Violin plot values and counts should be able to be derived from data. */ | ||
data: ScaleInput[]; | ||
/** Given an ScaleInput datum, returns the count for it. */ | ||
count?: (d: ScaleInput) => number; | ||
/** Given an ScaleInput datum, returns the value for it. */ | ||
value?: (d: ScaleInput) => number; | ||
data: Datum[]; | ||
/** Given an datum, returns the count for it. */ | ||
count?: (d: Datum) => number; | ||
/** Given an datum, returns the value for it. */ | ||
value?: (d: Datum) => number; | ||
/** Width of the violin plot glyph. */ | ||
@@ -19,2 +20,3 @@ width?: number; | ||
}; | ||
export default function ViolinPlot<ScaleInput extends object = BinDatum>({ left, top, className, data, width, count, value, valueScale, horizontal, children, ...restProps }: ViolinPlotProps<ScaleInput> & Omit<React.SVGProps<SVGPathElement>, keyof ViolinPlotProps<ScaleInput>>): JSX.Element; | ||
export default function ViolinPlot<Datum extends object>({ left, top, className, data, width, count, value, valueScale, horizontal, children, ...restProps }: ViolinPlotProps<Datum> & Omit<React.SVGProps<SVGPathElement>, keyof ViolinPlotProps<Datum>>): JSX.Element; | ||
//# sourceMappingURL=ViolinPlot.d.ts.map |
@@ -22,2 +22,10 @@ "use strict"; | ||
var defaultCountAccessor = function defaultCountAccessor(d) { | ||
return typeof d.count === 'number' ? d.count : 0; | ||
}; | ||
var defaultValueAccessor = function defaultValueAccessor(d) { | ||
return typeof d.value === 'number' ? d.value : 0; | ||
}; | ||
function ViolinPlot(_ref) { | ||
@@ -33,9 +41,5 @@ var _ref$left = _ref.left, | ||
_ref$count = _ref.count, | ||
count = _ref$count === void 0 ? function (d) { | ||
return d && d.count || 0; | ||
} : _ref$count, | ||
count = _ref$count === void 0 ? defaultCountAccessor : _ref$count, | ||
_ref$value = _ref.value, | ||
value = _ref$value === void 0 ? function (d) { | ||
return d && d.value || 0; | ||
} : _ref$value, | ||
value = _ref$value === void 0 ? defaultValueAccessor : _ref$value, | ||
valueScale = _ref.valueScale, | ||
@@ -51,3 +55,4 @@ horizontal = _ref.horizontal, | ||
var widthScale = (0, _scale.scaleLinear)({ | ||
rangeRound: [0, width / 2], | ||
range: [0, width / 2], | ||
round: true, | ||
domain: [0, Math.max.apply(Math, binCounts)] | ||
@@ -85,4 +90,5 @@ }); | ||
path = rightCurvePath + " " + leftCurvePath.replace('M', 'L') + " Z"; | ||
} | ||
} // eslint-disable-next-line react/jsx-no-useless-fragment | ||
if (children) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({ | ||
@@ -89,0 +95,0 @@ path: path |
{ | ||
"name": "@vx/stats", | ||
"version": "0.0.198", | ||
"version": "0.0.199", | ||
"description": "vx stats box violin", | ||
@@ -34,4 +34,4 @@ "sideEffects": false, | ||
"@types/react": "*", | ||
"@vx/group": "0.0.198", | ||
"@vx/scale": "0.0.198", | ||
"@vx/group": "0.0.199", | ||
"@vx/scale": "0.0.199", | ||
"classnames": "^2.2.5", | ||
@@ -47,3 +47,3 @@ "d3-shape": "^1.2.0", | ||
}, | ||
"gitHead": "4a418928be63a12834accbae246a69136c2e8c19" | ||
"gitHead": "b7fd57c8dede777c4983203046a704f52a61e226" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39813
23
849
1
+ Added@types/d3-color@1.4.5(transitive)
+ Added@types/d3-interpolate@1.4.5(transitive)
+ Added@vx/group@0.0.199(transitive)
+ Added@vx/scale@0.0.199(transitive)
+ Addedd3-array@2.12.1(transitive)
+ Addedd3-format@2.0.0(transitive)
+ Addedd3-scale@3.3.0(transitive)
+ Addedd3-time@2.1.1(transitive)
+ Addedd3-time-format@3.0.0(transitive)
+ Addedinternmap@1.0.1(transitive)
- Removed@vx/group@0.0.198(transitive)
- Removed@vx/scale@0.0.198(transitive)
- Removedd3-array@1.2.4(transitive)
- Removedd3-collection@1.0.7(transitive)
- Removedd3-format@1.4.5(transitive)
- Removedd3-scale@2.2.2(transitive)
- Removedd3-time-format@2.3.0(transitive)
Updated@vx/group@0.0.199
Updated@vx/scale@0.0.199