
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-chart-race
Advanced tools
The animated bar chart race helps you visualize your changing data in a wonderful way. It is quite easy to understand. A rising or decreasing bar moves up or down along with the animation.
npm install --save react-chart-race
import ChartRace from 'react-chart-race';
| Name | Value | Default | Description |
|---|---|---|---|
| data | Array | [] | Data required for drawing the graph. |
| backgroundColor | String | #f9f9f9 | The background color of the field. |
| width | Number | 680 | The width of the field. |
| padding | Number | 20 | The internal space of the field. |
| itemHeight | Number | 38 | The height of a bar. |
| gap | Number | 4 | Space between the bars from the outside. |
| titleStyle | Style | { font: 'normal 400 13px Arial', color: '#212121' } | The style values of the title. |
| valueStyle | Style | { font: 'normal 400 11px Arial', color: '#777' } | The style values of the value. |
An element must consist of 4 variables: id, title, value, color
<ChartRace data={[
{ id: 0, title: 'Ayfonkarahisar', value: 42, color: '#50c4fe' },
{ id: 1, title: 'Kayseri', value: 38, color: '#3fc42d' },
{ id: 2, title: 'Muğla', value: 76, color: '#c33178' },
{ id: 3, title: 'Uşak', value: 30, color: '#423bce' },
{ id: 4, title: 'Sivas', value: 58, color: '#c8303b' },
{ id: 5, title: 'Konya', value: 16, color: '#2c2c2c' }
]} />
import React, { Component } from 'react';
import ChartRace from 'react-chart-race';
export default class App extends Component{
constructor(props){
super(props);
this.state = {
data: []
};
this.handleChange();
setInterval(() => {
this.handleChange();
}, 2000);
}
getRandomInt(min, max){
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
handleChange(){
const data = [
{ id: 0, title: 'Ayfonkarahisar', value: this.getRandomInt(10, 90), color: '#50c4fe' },
{ id: 1, title: 'Kayseri', value: 38, color: '#3fc42d' },
{ id: 2, title: 'Muğla', value: this.getRandomInt(10, 90), color: '#c33178' },
{ id: 3, title: 'Uşak', value: this.getRandomInt(10, 90), color: '#423bce' },
{ id: 4, title: 'Sivas', value: 58, color: '#c8303b' },
{ id: 5, title: 'Konya', value: 16, color: '#2c2c2c' }
];
this.setState({ data });
}
render(){
return(
<div>
<ChartRace
data={this.state.data}
backgroundColor='#000'
width={760}
padding={12}
itemHeight={58}
gap={12}
titleStyle={{ font: 'normal 400 13px Arial', color: '#fff' }}
valueStyle={{ font: 'normal 400 11px Arial', color: 'rgba(255,255,255, 0.42)' }}
/>
</div>
);
}
}
If you want, you can also integrate the new values of the data on a socket connection.
FAQs
Animated bar chart race for ReactJS.
The npm package react-chart-race receives a total of 19 weekly downloads. As such, react-chart-race popularity was classified as not popular.
We found that react-chart-race 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.