Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-liquidchart

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-liquidchart

A Reusable liquid chart made with d3 and react

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55
decreased by-40.22%
Maintainers
1
Weekly downloads
 
Created
Source

React-liquidchart

Build Status Coverage Status

A Nice looking liquid chart done with d3 and react, based off http://bl.ocks.org/brattonc/5e5ce9beee483220e2f6

Install from NPM

npm install react-liquidchart

Example

For now, this will have to do.

Usage

import React, { Component } from 'react';
import { render } from 'react-dom';
import LiquidChart from 'react-liquidchart';

class ChartLiquid extends Component {
  constructor() {
    super();
  }

  render() {
    return (
      <div
        style={{
          width: '100%',
          height: '500px',
        }}
      >
        <LiquidChart
            responsive
            legend="Percentage of Completed Tasks"
            value={Math.random() * 100}
            showDecimal
            amplitude={4}
            frequency={2}
            animationTime={2000}
            animationWavesTime={2250}
            gradient={{
              type: 1,
              x1: 0,
              x2: 0,
              y1: 100,
              y2: 0,
            }}
            postfix="%"
            legendFontSize={0.1}
          />
      </div>
    );
  }
}
render(<ChartLiquid />, document.getElementById('app'));

LiquidChart PropTypes

NameTypeDefaultDescription
WidthnumbernullThe width of the chart, used if responsive is false
heightnumbernullThe width of the chart, used if responsive is false
responsivebooltrueIf set to true then the element will fill out into parent container, and resize on window dimension change
Valuenumber65The value, tops at 100 and 0 is the minimum
animationWavesTimenumbernullThe speed of the wave animation, going back and forth
animationTimenumber2000milliseconds for animation when updating value
animationEasestring'easeCubicInOut'The name of the d3 easing function, other values like, easeBack, easeBackInOut, easeSinInOut, easeExpInOut. See d3 easing page for more ideas.
outerBoundnumber0.9This is the outerRadius of the chart where 1 would be 100% of the radius and 0 would be 0% of the radius..
innerBoundnumber0.8The innerwidth of the outerpath surronding the liquid, again 0.8 would be 80% of the radius.
marginnumber0.025The margin between the outer path and the liquid, here 0.025 would be 2.5%
amplitudenumber4The Amplitude X * sine(frequency) part of the formula
frequencynumber2The frequency, how many full circles are in the chart.
waveScaleLimitbooltrueThis is in the original, this will create a scale that limits the wave height close to 0 or 100
outerStyleshape{ fill: 'rgb(23,139,202)'}The style of the outerarc fill and stroke
liquidStyleshape{ fill: 'rgb(23, 139, 202)'}The style of the liquid, fill and stroke
dryStyleshape{fill: 'rgb(164, 219, 248)'}The style of the number that is in the liquid, fill and stroke
wetStyleshape{fill: 'rgb(4, 86, 129)'}The style of the number that is not in the liquid, fill and stroke
fontSizesshapeThe sizes of the fonts in ratio to the radius.
Licence

This software was available initially under the BSD-2-Clause and it still is. Please see the original and put a github like on it at https://gist.github.com/brattonc/5e5ce9beee483220e2f6

Keywords

FAQs

Package last updated on 15 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc