# react-stacked-horizontal-bar-chart

> A react component for rendering stacked horizontal bar chart with multiple bars, where markers can be added to mark results or points.

Latest version **1.0.1** (published 2020-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-stacked-horizontal-bar-chart
pnpm add react-stacked-horizontal-bar-chart
yarn add react-stacked-horizontal-bar-chart
bun add react-stacked-horizontal-bar-chart
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-09-11 |
| First published | 2020-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ehab Alsharif |
| Maintainers | sanehab |
| Keywords | react, stacked, horizontal, bar, chart, graph, ranges, range, markers, points, bars, graphs, charts |

## Links

- npm: https://www.npmjs.com/package/react-stacked-horizontal-bar-chart
- Repository: https://github.com/sanehab/react-stacked-horizontal-bar-chart
- Issues: https://github.com/sanehab/react-stacked-horizontal-bar-chart/issues
- npm.io page: https://npm.io/package/react-stacked-horizontal-bar-chart

## Dependencies (1)

- [classnames](https://npm.io/package/classnames.md) ^2.2.6

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-09-11
- 1.0.0 — 2020-09-11

## README

# StackedHorizontalBarChart

A responsive stacked horizontal bar chart with multiple bars, where markers can be added to mark results or points.

## Installation

The package can be installed via NPM:

```
npm install react-stacked-horizontal-bar-chart
```

React and prop-types are peer dependencies that you have to install yourself, you need to install react version that supports hooks.

## Demo

Some examples can be be found here, https://codesandbox.io/s/gracious-khayyam-i7xbt?file=/src/App.js

## Usage

```js
import { StackedHorizontalBarChart } from 'react-stacked-horizontal-bar-chart';

const Component = () => {
  return (
    <StackedHorizontalBarChart
      rangesPoints={[0, 10, 20, 30]}
      backgroundColors={['#4F81BD', '#C0504D', '#9BBB59']}
    />
  );
};
```

| Prop                       | Type    | Default Value | Description                                                                                                                                |
| -------------------------- | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| height                     | Integer | 10            | Height of the bars                                                                                                                         |
| rangesPoints               | Array   | []            | Array of unique numbers to mark bars, numbers can be negative, positive, or zero, but the array should be sorted                           |
| ranges                     | Array   | []            | Array of bars widths, rangesPoints and ranges should not be used together, only one of them should be used                                 |
| edges                      | Array   | []            | Array of two elements, either string or number, will be used to mark the edges of the graph, regardless of the actual values               |
| backgroundColors           | Array   | required      | Array of colors to use for corresponding bars, if backgroundColors length is less than bars, then colors will be reused based on mod index |
| points                     | Array   | []            | Array of marker objects that should be added to the graph                                                                                  |
| shouldLimitPointsPositions | Boolean | true          | Markers should be kept within the bounds of the graph regardless of their values                                                           |
| classes                    | Object  | {}            | Object used to override default classes                                                                                                    |

## License

Licensed under MIT license, see [LICENSE](LICENSE) for the full license.

---
_Source: https://npm.io/package/react-stacked-horizontal-bar-chart · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
