Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
react-liquidchart
Advanced tools
A Nice looking liquid chart done with d3 and react
Download the package from npm
npm i -S react-liquidchart
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Chart, Liquid, Gradient } from 'react-liquidchart';
class ChartLiquid extends Component {
constructor() {
super();
this.onClick = this.onClick.bind(this);
this.state = ({
value: (Math.random() * 100),
});
}
onClick() {
this.setState({
value: (Math.random() * 100),
});
}
render() {
return (
<div
style={{
width: '100%',
height: '500px',
}}
>
<Chart
responsive
gradient="liquid"
>
<Liquid
animate
animateWaves
onClick={this.onClick}
amplitude={4}
value={this.state.value}
/>
<Gradient />
</Chart>
</div>
);
}
}
render(<ChartLiquid />, document.getElementById('app'));
The Chart container component, calculates width and height and renders the svg and charts
Makes the chart listen to changes in screen size and resize the chart on screen resize
If gradient then the liquid will take the values in the Gradient element
The Liquid Component has all the visable Components
a percentage from 0 to 100
if true then animate
if true then animate waves
If true then add gradient effect on liquid based on liquid.fill color
A function that is called when animation is done
A fill and stroke for the outer arc, defaults to fill: 'rgb(23, 139, 202)'
A fill and stroke for the liquid, defaults to fill: 'rgb(23, 139, 202)'
A fill and stroke for the part of the number that is in liquid defaults to fill: 'rgb(164, 219, 248)',
A fill and stroke for the 'dry' part of the number default to fill: 'rgb(4, 86, 129)'
the wave height
The inverse of frequency actually, the higher the number the smother the wave
scaling the wave when it´s close to 0 or 100 so the area does not appear empty or full at those values
The font size attribute for the number
font size for the percentage sign
The Gradient is just a thin wrapper for linearGradient it takes in stop children, if none are set it makes a gradient out of different shades of the liquid.fill proptype
Testing done with Jest
npm run test
Run the webpack dev server
npm run start
#Credits This is a react remake and slightly altered version of http://bl.ocks.org/brattonc/5e5ce9beee483220e2f6 So a big thanks to Chris Bratton for making the original!
FAQs
A Reusable liquid chart made with d3 and react
The npm package react-liquidchart receives a total of 44 weekly downloads. As such, react-liquidchart popularity was classified as not popular.
We found that react-liquidchart demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.