npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@garvae/react-pie-chart

v1.1.5-deprecated

Published

Lightweight react svg "pie" chart

Downloads

79

Readme

DEPRECATED

⛔ This package was deprecated

✔️Please use the new more powerful and flexible version: react-pie-donut-chart

react-pie-chart

Description

Lightweight react "pie" chart.

Features

  • responsive (svg re-renders when it's needed)
  • ability to show some text in center "donut hole"
  • ready for TypeScript

Variants

Notes

You can choose if you want to resize the chart based on the parent size or if you want to set the size manually. If you want resizable chart, you must be sure the parent container does not have zero width and height. If you want to set the size manually just add the size property

Installation

npm install @garvae/react-pie-chart

or

yarn add @garvae/react-pie-chart

Properties

Required

Data - an array of objects with properties described below:

| Name | Type | Default | Required | Description | | --- | --- | --- | --- | --- | | color | string | - | + | Color of chart segment. Must be a CSS 'color' type | | order | number | - | + | Order of segment in pie chart map | | segmentId | string | - | + | Unique id of chart segment | | value | number | - | + | Value of segment |

Required if size prop isn't given

parentRef - React.RefObject.<HTMLDivElement> - Ref to container element

Required if parentRef prop isn't given

size - number - Chart size. Chart element will not be resizable when this property is given

Optional

| Name | Type | Default | Description | | --- | --- | --- | --- | | className | string | | SVG className | | donutHoleClassName | string | | Center circle className | | donutHoleColor | string | "#ffffff" | Center circle color | | donutHoleRadius | number | 27.5% of calculated container size | Center circle radius | | donutSegmentClassName | string | | Circle segment className | | fontSize | string | | Center circle text size. Must be a CSS 'fontSize' type: 'px' | | minSize | number | | Chart minimum size | | text | string | | Center circle text. Must be short enough to fit in the center of the chart. Center circle will not be shown when this property is not given. | | textClassName | string | | ClassName of the element that wraps center circle text | | textColor | string | | Center circle text color | | textGroupClassName | string | | (group) element that wraps center circle text | | textSvgObjectClassName | string | | element that wraps center circle text | | debounceTime | number | 50 | Prevents unnecessary re-renders. Default 50ms. Debounce disabled when 'debounceTime' = 0 or when 'size' property value is given |


Example

import ChartPie from '@garvae/react-pie-chart'

const DATA = [
    {
        color: '#e74949',
        order: 1,
        segmentId: '001',
        value: 12,
    },
    {
        color: '#49bae7',
        order: 2,
        segmentId: '002',
        value: 17,
    },
    {
        color: '#e7a849',
        order: 3,
        segmentId: '003',
        value: 18,
    },
    {
        color: '#e76e49',
        order: 4,
        segmentId: '004',
        value: 9,
    },
    {
        color: '#78e749',
        order: 5,
        segmentId: '005',
        value: 30,
    }
]

const App = () => {
    const ref = React.useRef<HTMLDivElement>(null)

    return (
      <div
       ref={ref}
       // here we use parent container size to resize chart depends on it 
       style={{
              display: 'flex',
              width: '600px',
              height: '600px',
          }}
      >
          <ChartPie data={DATA} parentRef={ref}/>
      </div>
    );
};

Author

🙋‍♂️ Vova_Garvae

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐ and your ❤️ if this project helped you!

❤️️ https://ko-fi.com/garvae

❤️️ https://pay.cloudtips.ru/p/859caa2a