2.1.0 • Published 3 years ago

poly-chart v2.1.0

Weekly downloads
738
License
ISC
Repository
github
Last release
3 years ago

PolyChart

A bare-bones canvas based component for data visualization in React. This chart is customizable, animated (tweenable too) and responsive.

Installation

npm install poly-chart

Usage

Here's a live demo to play around with: Codepen Demo

general

import { PolyChart } from 'poly-chart';

const MyComponent = (props) => {

   //can be either a single object or an array of objects with identical keys (keys are used as labels)
   const myData = {...}; 

   //look below for options object examples
   const myOptions = {...};

   //the chart will shrink and expand according to its container's size
   return <PolyChart data={myData} options={myOptions} />;

};

options object examples

const complexOptions = {

   increments: 10,

   animation: {
      tween: true,
      delay: [0, 500, 1000], //if an array is supplied each value will be applied to its corresponding polygon (based on index)
      duration: [2000, 1000, 5000],
      easingFunction: ['easeOutElastic', 'easeOutBounce', 'linear']
   },

   style: {

      label: {
         fontSize: 12.5,
         fontFamily: 'Helvetica'
      },

      chart: {
         background: true,
         fill: 'rgba(255, 255, 0, 1)',
         stroke: 'rgba(0, 0, 0, 1)'
      },

      polygon: {
         contour: true,
         fill: ['rgba(3, 5, 183, 0.6)', 'rgba(255, 0, 0, 0.6)', 'rgba(0, 210, 79, 0.6)'],
         stroke: ['rgb(3, 5, 183)', 'rgb(255, 0, 0)', 'rgb(0, 210, 79)'],
         lineWidth: 2
      }

   }

};
const simpleOptions = {

   increments: 5,

   style: {

      label: {
         fontSize: 16,
         fontFamily: 'sans-serif'
      },

      chart: { stroke: 'rgba(0, 0, 0, 1)' },

      polygon: { fill: 'rgba(0, 210, 79, 0.6)' }

   }

};
2.0.4

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago