1.2.2 • Published 3 years ago

react-pswot-plot v1.2.2

Weekly downloads
24
License
MIT
Repository
github
Last release
3 years ago

react-pswot-plot

by the Growth Lab at Harvard's Center for International Development

React component for creating a SWOT scatterplot with a beeswarm at the zero-axis for Potential

This package is part of Harvard Growth Lab’s portfolio of software packages, digital products and interactive data visualizations. To browse our entire portfolio, please visit The Viz Hub at growthlab.app. To learn more about our research, please visit Harvard Growth Lab’s home page.

NPM JavaScript Style Guide

View live example ↗

Install

npm install --save react-pswot-plot

Usage

import React from 'react'
import PSwotPlot from 'react-pswot-plot'

const App = () => {

  ...

  return (
    <Root>
      <PSwotPlot
        id={'react-pswot-plot-demo'}
        data={data}
      />
    </Root>
  )
}

Props

The PSwotPlot component takes the following props:

  • id: string
  • data: Datum[]
  • chartTitle: string
  • axisLabels (optional):
    • left (optional): string
    • leftUp (optional): string
    • leftDown (optional): string
    • bottom (optional): string
    • bottomLeft (optional): string
    • bottomRight (optional): string
  • axisMinMax (optional):
    • minX (optional): number
    • maxX (optional): number
    • minY (optional): number
    • maxY (optional): number
  • averageLineText (optional): string
  • averageLineTextDesc (optional): string
  • yLineText (optional): string
  • yLineTextDesc (optional): string
  • zeroAxisLabel (optional): string
  • quadrantLabels (optional):
    • I (optional): string
    • II (optional): string
    • III (optional): string
    • IV (optional): string
    • V (optional): string
  • axisLabelColor (optional): string
  • quadrantLabelColor (optional): string
  • quadrantBackgroundColors (optional):
    • I (optional): string
    • II (optional): string
    • III (optional): string
    • IV (optional): string
    • V (optional): string
  • onQuadrantLabelMouseMove (optional): (quadrant: {id: string, label: string}, coords: {x: number, y: number}) => void
  • onQuadrantLabelMouseLeave (optional): (quadrant: {id: string, label: string}) => void

Datum

The Datum type is an interface of the following values:

  • id: string
  • label: string
  • x: number
  • y: number
  • fill (optional): string
  • stroke (optional): string
  • radius (optional): number
  • onClick (optional): (datum: Datum) => void
  • onMouseMove (optional): (datum: Datum, coords: {x: number, y: number}) => void
  • onMouseLeave (optional): (datum: Datum) => void
  • highlighted (optional): boolean
  • faded (optional): boolean

License

MIT © The President and Fellows of Harvard College

1.2.2

3 years ago

1.2.0

3 years ago

1.1.9

3 years ago

1.1.8

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.2.1

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.2

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago