1.0.3 • Published 3 years ago

fast-wind-rose v1.0.3

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

FAST wind rose

Introduction

The FAST wind rose provides a visual representation of the relative wind. It was purposely written for FAST.

Main principles the FAST wind rose are:

  1. Simple deploy as React component.
  2. Adaptive set attributes to determine the look and size.

Installation

You can install fast-wind-rose via Yarn or npm:

# If using Yarn:
yarn add fast-wind-rose

# If using npm:
npm install --save fast-wind-rose

The core component from react-fout-stager is Windrose. This module can be required via ES imports or CommonJS require.

import Windrose from 'fast-wind-rose';

// using require
const Windrose = require('fast-wind-rose');

Usage

import React from 'react'
import { render } from 'react-dom'
import Windrose from 'fast-wind-rose'
import mockData from './mocks'

render(
  <Windrose
    dirData={mockData.metrics[1].values}
    spdData={mockData.metrics[0].values}
    interval={1}
    sectorCount={12}
    size={500}
    legend
  />, document.getElementById('root'))

PROPS & METHODS

Prop nameTypeDefaultDescription
commonKeystringtimestampCommon key between direction and speed data
dirDataobject[]Array with directional data for the wind
dirKeystringvalueKey for directional data
spdDataobject[]Array with speed data for the wind
spdKeystringvalueKey for speed data
enlargenumber1Scales the compilation scale against the viewbox. Choose a value lower than 1 to scale down and larger than 1 to scale up.
intervalnumber1Fixed interval between data points specified in hours. For example if data points are every 30 min, then value should be 0.5
legendboolHide or display legend
scaleobjectShapeScale of speeds with the linked color. Example as follows: { 0: 'rgb(60,95,156)', 5: 'rgb(94,131,188)' }
sectorArraynumber[]4, 8, 12, 16, 24, 32, 36Array that defines the number of sectors the user can choose from.
sectorCountcustom12Default number of sectors. Must be included in sectorArray.
sizenumber260Width/height of chart. Will be displayed in specified viewbox.

License

MIT