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

univariate-infographics

v1.0.0

Published

React component library of SVG info-graphics for displaying uni-variate data

Downloads

1

Readme

univariate-infographics

React component library of SVG info-graphics for displaying uni-variate data

NPM JavaScript Style Guide

github hackersupreme.com

Install

npm install --save univariate-infographics

Components

  • <PieChart data={data} />
  • <PieSlice data={data} />
  • <BarChart data={data} />
  • <HorizontalBar data={data} />
  • <VerticalBar data={data} />

All Components

Usage

import React from 'react'

import { PieChart, BarChart, PieSlice, HorizontalBar, VerticalBar } from 'univariate-infographics'

Data Config

Each component takes in an array of objects called data. Each object must have a value property that represents the value of the item in the data set. You can also include other properties if you want to use them in a component's legend or as an overlay on some of the components.


// this is all that's required for the components to work
const data = [
  {
    value: 1
  },
  {
    value: 2
  }
]

/*
=== BUT ===
*/

// you can also add more fields
const data = [
  {
    value: 3,
    label: 'Plot A',
    unit: 'acres',
    ...
  },
  {
    value: 5,
    label: 'Plot B',
    unit: 'acres',
    ...
  }
]

PieChart

Pie Chart

How to use


const data = [
  {
    value: 1
  },
  {
    value: 2
  }
]

const Example = () => (
  <PieChart
    data={data}
  />
)

Props

Property | Type | Default | Description -------- | ---- | ------- | ----------- data (required) | array | - | Data to be represented by component width | number | 200 | Pixel width of component height | number | 200 | Pixel height of component baseColor | string | '#4095bf' | Starting color for component's gradient. Accepts rgb, hsl, and hex color formats title | string | null | Title of component titleColor | string | '#1d3940' | Text color of title. Accepts any color format highlightColor | string | '#884ca1' | Hover color of component. Accepts any color format donut | boolean | false | Turns the pie chart into a donut chart donutColor | string | 'white' | Color of inner donut circle. Accepts any color format legend | boolean | false | Includes a legend for the component. legendColor | string | '#1d3940' | Text color of legend. Accepts any color format legendDataType | string | 'value' | Selects the property of the objects in the data array to display in the legend orientation | number (0-1) | 0 | Where the start of the piechart is on the circle. eg, 0, 1, 0.25, 0.5, etc circleArea | number (0-1) | 1 | What percentage of the circle should the pie chart fill gradientDirection | string | null | Set to 'reverse' to reverse the gradient in the component style | obj | null | Style object passed to the component className | string | null | Class names to be added to the component

Examples

Donut

Pie Chart With Legend

PieSlice

Pie Slice

How to use


const data = [
  {
    value: 1
  },
  {
    value: 2
  }
]

const Example = () => (
  <PieSlice
    data={data}
   />
)

Props

Property | Type | Default | Description -------- | ---- | ------- | ----------- data (required) | array | - | Data to be represented by component slice | number | 0 | Index of data array that is going to displayed width | number | 200 | Pixel width of component height | number | 200 | Pixel height of component baseColor | string | '#4095bf' | Color of slice secondaryColor | string | '#e9ecef' | Background color of pie chart title | string | null | Title of component titleColor | string | '#1d3940' | Text color of title. Accepts any color format donut | boolean | false | Turns the pie chart into a donut chart donutColor | string | 'white' | Color of inner donut circle. Accepts any color format legend | boolean | false | Includes a legend for the component. legendColor | string | '#1d3940' | Text color of legend. Accepts any color format legendDataType | string | 'value' | Selects the property of the objects in the data array to display in the legend orientation | number (0-1) | 0 | Where the start of the piechart is on the circle. eg, 0, 1, 0.25, 0.5, etc circleArea | number (0-1) | 1 | What percentage of the circle should the pie chart fill gradientDirection | string | null | Set to 'reverse' to reverse the gradient in the component style | obj | null | Style object passed to the component className | string | null | Class names to be added to the component

Examples

Pie Slice with Legend

BarChart

Bar Chart

How to use


const data = [
  {
    value: 1
  },
  {
    value: 4
  },
  {
    value: 2
  }
]


const Example = () => (
  <BarChart
    data={data}
   />
)

Props

Property | Type | Default | Description -------- | ---- | ------- | ----------- data (required) | array | - | Data to be represented by component width | number | 200 | Pixel width of component height | number | 200 | Pixel height of component barWidth | number | 20 | Pixel width of individual bars baseColor | string | '#4095bf' | Starting color for component's gradient. Accepts rgb, hsl, and hex color formats title | string | null | Title of component titleColor | string | '#1d3940' | Text color of title. Accepts any color format highlightColor | string | '#884ca1' | Hover color of component. Accepts any color format legend | boolean | false | Includes a legend for the component. legendColor | string | '#1d3940' | Text color of legend. Accepts any color format legendDataType | string | 'value' | Selects the property of the objects in the data array to display in the legend overlay | boolean | false | Include an overlay value on the bars of the component overlayColor | string | '#1d3940' | Text color of overlay. Accepts any color format overlayDataType | string | 'value' | Selects the property of the objects in the data array to display in the overlay gradientDirection | string | null | Set to 'reverse' to reverse the gradient in the component style | obj | null | Style object passed to the component className | string | null | Class names to be added to the component

Examples

Bar Chart with Legend

Bar Chart with Overlay

HorizontalBar

Horizontal Bar

How to use


const data = [
  {
    value: 1
  },
  {
    value: 4
  },
  {
    value: 2
  }
]

const Example = () => (
  <HorizontalBar
    width={400}
    height={50}
    data={data}
   />
)

Props

Property | Type | Default | Description -------- | ---- | ------- | ----------- data (required) | array | - | Data to be represented by component width | number | 200 | Pixel width of component height | number | 200 | Pixel height of component baseColor | string | '#4095bf' | Starting color for component's gradient. Accepts rgb, hsl, and hex color formats title | string | null | Title of component titleColor | string | '#1d3940' | Text color of title. Accepts any color format highlightColor | string | '#884ca1' | Hover color of component. Accepts any color format legend | boolean | false | Includes a legend for the component. legendColor | string | '#1d3940' | Text color of legend. Accepts any color format legendDataType | string | 'value' | Selects the property of the objects in the data array to display in the legend overlay | boolean | false | Include an overlay value on the bars of the component overlayColor | string | '#1d3940' | Text color of overlay. Accepts any color format overlayDataType | string | 'value' | Selects the property of the objects in the data array to display in the overlay gradientDirection | string | null | Set to 'reverse' to reverse the gradient in the component style | obj | null | Style object passed to the component className | string | null | Class names to be added to the component

Examples

Horizontal Bar with Overlay

Horizontal Bar with Legend

VerticalBar


const data = [
  {
    value: 1
  },
  {
    value: 4
  },
  {
    value: 2
  }
]

const Example = () => (
  <VerticalBar
    width={50}
    height={200}
    data={data}
   />
)

Vertical Bar

Props

Property | Type | Default | Description -------- | ---- | ------- | ----------- data (required) | array | - | Data to be represented by component width | number | 200 | Pixel width of component height | number | 200 | Pixel height of component baseColor | string | '#4095bf' | Starting color for component's gradient. Accepts rgb, hsl, and hex color formats title | string | null | Title of component titleColor | string | '#1d3940' | Text color of title. Accepts any color format highlightColor | string | '#884ca1' | Hover color of component. Accepts any color format legend | boolean | false | Includes a legend for the component. legendColor | string | '#1d3940' | Text color of legend. Accepts any color format legendDataType | string | 'value' | Selects the property of the objects in the data array to display in the legend overlay | boolean | false | Include an overlay value on the bars of the component overlayColor | string | '#1d3940' | Text color of overlay. Accepts any color format overlayDataType | string | 'value' | Selects the property of the objects in the data array to display in the overlay gradientDirection | string | null | Set to 'reverse' to reverse the gradient in the component style | obj | null | Style object passed to the component className | string | null | Class names to be added to the component

Examples

Vertical Bar with Legend

Vertical Bar with Overlay

License

MIT © hackersupreme