react-plot

3.0.0 • Public • Published

react-plot

Library of React components to render SVG 2D plots.

Check our exhaustive documentation here.

Maintained by Zakodium

NPM version npm download

const Example = () => (
  <Plot
    width={550}
    height={500}
    margin={{ bottom: 50, left: 90, top: 50, right: 100 }}
  >
    <Heading
      title="Electrical characterization"
      subtitle="current vs voltage"
    />
    <LineSeries
      data={[
        { x: 0, y: 0 },
        { x: 1, y: 1 },
        { x: 2, y: 2 },
        { x: 3, y: 3 },
        { x: 4, y: 3 },
        { x: 5, y: 3 },
      ]}
      xAxis="x"
      yAxis="y"
      lineStyle={{ strokeWidth: 3 }}
      label="Vg = 7V"
      displayMarker={false}
    />
    <LineSeries
      data={[
        { x: 0, y: 0 },
        { x: 1, y: 1 },
        { x: 2, y: 2 },
        { x: 3, y: 3 },
        { x: 4, y: 3 },
        { x: 5, y: 3 },
      ]}
      xAxis="x"
      yAxis="y"
      displayMarker={true}
      markerShape="circle"
      label="Vg = 3V"
    />
    <Axis
      id="x"
      position="bottom"
      label="Drain voltage [V]"
      displayPrimaryGridLines
      max={6.1 / factor}
    />
    <Axis
      id="y"
      position="left"
      label="Drain current [mA]"
      displayPrimaryGridLines
      max={6.1 * factor}
    />
    <Legend position="right" />
  </Plot>
);

This code will result in this example

Plot Example

Installation

$ npm install --save react-plot

Debugging

For major React hooks debugging use @simbathesailor/use-what-changed

import { useWhatChanged } from '@simbathesailor/use-what-changed';

function Example() {

  // useEffect, useCallback or useMemo
  useWhatChanged([a, b, c, d]); // debugs the below useEffect

  // displays names of variables instead of index
  // useWhatChanged([a, b, c, d], 'a, b, c, d', 'anysuffix-string');
  React.useEffect(() => {
    // console.log("some thing changed , need to figure out")
  }, [a, b, c, d]);

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.0622latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.0622
2.0.03
1.4.2241
1.4.11
1.4.00
0.20.41
0.20.34
0.20.21
0.20.11
0.20.01
0.19.11
0.19.01
0.18.01
0.17.12
0.17.01
0.16.01
0.15.01
0.14.01
0.13.11
0.13.01
0.12.01
0.11.01
0.10.26
0.10.11
0.10.01
0.9.01
0.8.01
0.7.11
0.6.02
0.5.01
0.4.01
0.3.01
0.2.11
0.2.01
0.1.01

Package Sidebar

Install

npm i react-plot

Weekly Downloads

907

Version

3.0.0

License

MIT

Unpacked Size

573 kB

Total Files

383

Last publish

Collaborators

  • stropitek
  • targos
  • lpatiny
  • zakodium-bot