funnel-react-2

0.1.6 • Public • Published

Funnel-react logo2

NPM JavaScript Style Guide

Funnel-react logo

Note

This package is forked from this repo. What is new in this package.

  • Drop off perecentage between funnel stages.
  • React callbacks to customize the rendering for labels, values, precentages and drop off precentages.
  • Percentages now displayed nicely inside the funnel itself.

Install

npm install --save funnel-react-2

or

yarn add funnel-react-2

Usage

import { Funnel } from 'funnel-react-2';

##Simple example

<Funnel
    height={252}
    colors={{
      graph: [ '#1890FF', '#BAE7FF' ],
      percent: 'red',
      label: 'yellow',
      value: 'orange'
    }}
    displayPercent={true}
    valueKey='quantity'
    width={800}
    data={data}
    renderLabel={(index, value) => {
      return (
        <span>
          {value}
        </span>
      );
    }}
    renderPercentage={(index, value) => {
      return (
        <span>
          {value}
        </span>
      );
    }}
    renderDropOffPercentage={(index, value) => {
        return (
          <span>{value} %</span>
        );
      }
    }}
    renderValue={(index, value) => {
      return (
        <span>
          {value}
        </span>
      );
    }}
  />
props Type Default Value Options
labelKey string
colors object
valueKey string
width number container width
displayPercent boolean false false / true
data array
renderLabel function null
renderValue function null
renderPercentage function null
renderDropOffPercentage function null

License

MIT © xavivzla, whitechess

Package Sidebar

Install

npm i funnel-react-2

Weekly Downloads

14

Version

0.1.6

License

MIT

Unpacked Size

815 kB

Total Files

6

Last publish

Collaborators

  • whitechess