React Box Plot Component

4.0.0 · maintenance · verified Sun Apr 19

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.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates rendering a horizontal box plot using `react-boxplot` by passing raw data values and letting the library compute the statistics.

import React from 'react';
import Boxplot, { computeBoxplotStats } from 'react-boxplot';

const values = [
  14, 15, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 20,
  20, 20, 20, 20, 20, 21, 21, 22, 23, 24, 24, 29
];

const BoxplotExample = () => (
  <Boxplot
    width={400}
    height={20}
    orientation="horizontal"
    min={0}
    max={30}
    stats={computeBoxplotStats(values)}
  />
);

export default BoxplotExample;

view raw JSON →