0.0.4 • Published 2 years ago

mono-stacked-bar v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

mono-stacked-bar

A simple mono stacked bar

NPM JavaScript Style Guide

Examples

Edit mono-stacked-bar

Install

npm install --save mono-stacked-bar
# or using yarn
yarn add mono-stacked-bar

Do not forget to include the css file !

  • Using ES6 with a module bundler like Webpack
import "mono-stacked-bar/dist/index.css"
  • With good old reliable HTML tag
<head>
  <link href="node_modules/mono-stacked-bar/dist/index.css" rel="stylesheet" />
</head>

Usage

import React from "react"
import MonoStackedBar from "mono-stacked-bar"
import "mono-stacked-bar/dist/index.css"

const App = () => {
  return <MonoStackedBar data={[10, 20, 15]} />
}

Required props

The data "props" can have two forms.

Note : caption are shown underneath the bar. | props | type | properties | sample | --- | --- | --- | --- | data | number[] | | [10, 20, 25] data | BarData[] | value: number (required)color: string (optional)caption: string (optional) | { value: 10, color: "red", caption: "Some text" }, { value: 15, color: "orange" }

Optional props

propstypedefaultdescription
colorstringblueA default set of colors picked thanks to the randomcolor package
labelColorstringwhiteDefault color for all labels
displayLabelsbooleantrueShould data values be displayed inside bar sections
unitstring""The unit to be displayed after labels (%, $, etc)
widthnumber (px)Max width of the stacked bar (full-width by default)
heightnumber (px)20The height of the stacked bar
radiusnumber (px)10The border radius applied to the edges
0.0.4

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago