react-boxplot is a React component for rendering simple SVG box plots. It provides flexibility for both horizontal and vertical orientations and aligns the major axis coordinate system with the original data values. The current stable version is 4.0.0. This library is a maintained fork of an originally abandoned repository, suggesting a slower, maintenance-driven release cadence focused on stability and bug fixes rather than rapid feature development. Its key differentiators include its pure SVG rendering, allowing for easy styling and scalability, and the option to either compute box plot statistics internally via `computeBoxplotStats` or provide pre-calculated statistics, catering to different data processing workflows.
npm install react-boxplotVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates rendering a horizontal box plot using `react-boxplot` by passing raw data values and letting the library compute the statistics.
Monitor GitHub repository for activity and consider contributing to ensure longevity if critical features are needed.
Ensure your project's React and ReactDOM versions are within the `^15.0.0 || ^16.0.0 || ^17.0.0` range. Upgrade React if necessary or consider using an older version of `react-boxplot` if tied to an incompatible React version.
Always validate the `stats` object before passing it to the Boxplot component, especially if derived from external data sources. Utilize `computeBoxplotStats` for reliable calculation from raw data.
Change `import { Boxplot } from 'react-boxplot'` to `import Boxplot from 'react-boxplot'`.Ensure the `stats` prop is always provided with a valid object conforming to the expected structure, including `whiskerLow`, `quartile1`, `quartile2`, `quartile3`, `whiskerHigh`, and an `outliers` array (even if empty). Use `computeBoxplotStats()` to generate a valid `stats` object from raw data.