JSPM

react-charts

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26393
  • Score
    100M100P100Q133079F
  • License MIT

Simple, immersive & interactive charts for React

Package Exports

  • react-charts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-charts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-charts

Simple, immersive & interactive charts for React

Features

  • Hyper Responsive
  • Declarative & Deterministic
  • Highly performant
  • Built-in Animation (using React-Move)
  • Flexible data model support
  • Simple & powerful API

Demo

Table of Contents

Installation

$ yarn add react-charts

Quick Example

import React from 'react'
import { Chart, Axis, Series, Tooltip, Cursor, Line } from 'react-charts'

const lineChart = (
  <Chart data={...}>
    <Axis
      primary
      type="time"
      position="bottom"
    />
    <Axis
      type="linear"
      position="left"
    />
    <Series type={Line} />
    <Tooltip />
    <Cursor primary />
    <Cursor />
  </Chart>
)

Curve Types

All series types that support lines or curves can be configured to use any curve function from d3-shape by passing one of the following strings as the curve prop to a series component. You may also pass your own curve function directly from d3 or if you're feeling powerful, even create your own!

Note the following string correspond to their respective d3 curve functions but with the curve prefix removed.

  • basisClosed
  • basisOpen
  • basis
  • bundle
  • cardinalClosed
  • cardinalOpen
  • cardinal
  • catmullRomClosed
  • catmullRomOpen
  • catmullRom
  • linearClosed
  • linear
  • monotoneX (default)
  • monotoneY
  • natural
  • step
  • stepAfter
  • stepBefore

Example

<Chart>
  ...
  <Series type={Line} curve='cardinal' />
</Chart>

Contributing

To suggest a feature, create an issue if it does not already exist. If you would like to help develop a suggested feature follow these steps:

  • Fork this repo
  • $ yarn
  • $ yarn run storybook
  • Implement your changes to files in the src/ directory
  • View changes as you code via our React Storybook localhost:8000
  • Make changes to stories in /stories, or create a new one if needed
  • Submit PR for review

Scripts

  • $ yarn run storybook Runs the storybook server
  • $ yarn run test Runs the test suite
  • $ yarn run prepublish Builds for NPM distribution
  • $ yarn run docs Builds the website/docs from the storybook for github pages