Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Victory is a collection of composable React components for building interactive data visualizations. It provides a wide range of chart types and is designed to be highly customizable and easy to use.
Line Chart
Victory allows you to create line charts easily. The code sample demonstrates how to create a simple line chart using VictoryLine and VictoryChart components.
const data = [
{ x: 1, y: 2 },
{ x: 2, y: 3 },
{ x: 3, y: 5 },
{ x: 4, y: 4 },
{ x: 5, y: 7 }
];
<VictoryChart>
<VictoryLine data={data} />
</VictoryChart>
Bar Chart
Victory makes it simple to create bar charts. The code sample shows how to create a bar chart using VictoryBar and VictoryChart components.
const data = [
{ x: 'A', y: 2 },
{ x: 'B', y: 3 },
{ x: 'C', y: 5 },
{ x: 'D', y: 4 },
{ x: 'E', y: 7 }
];
<VictoryChart>
<VictoryBar data={data} />
</VictoryChart>
Pie Chart
VictoryPie component allows you to create pie charts. The code sample demonstrates how to create a pie chart with different categories.
const data = [
{ x: 'Cats', y: 35 },
{ x: 'Dogs', y: 40 },
{ x: 'Birds', y: 25 }
];
<VictoryPie data={data} />
Scatter Plot
VictoryScatter component is used to create scatter plots. The code sample shows how to create a scatter plot using VictoryScatter and VictoryChart components.
const data = [
{ x: 1, y: 2 },
{ x: 2, y: 3 },
{ x: 3, y: 5 },
{ x: 4, y: 4 },
{ x: 5, y: 7 }
];
<VictoryChart>
<VictoryScatter data={data} />
</VictoryChart>
Recharts is a Redefined chart library built with React and D3. It provides a set of composable chart components that are easy to use and highly customizable. Compared to Victory, Recharts has a more extensive set of chart types and is known for its performance and ease of integration.
Nivo provides a rich set of dataviz components, built on top of D3 and React. It offers a wide range of chart types and is highly customizable. Nivo is known for its beautiful and responsive charts, and it provides a variety of themes and styles out of the box. Compared to Victory, Nivo offers more advanced features and better aesthetics.
React wrapper for Chart.js, a popular JavaScript charting library. It provides a simple way to create charts using Chart.js in React applications. Compared to Victory, react-chartjs-2 is more lightweight and leverages the powerful Chart.js library for rendering charts.
$ npm install victory --save
import React, { Component } from 'react';
import { render } from 'react-dom';
import { VictoryPie } from 'victory';
class PieChart extends Component {
render() {
return (
<VictoryPie />
);
}
}
render(<PieChart />, document.getElementById('app'));
VictoryPie
component will be rendered, and you should see:
Projects using Victory should also depend on React and prop-types.
Want to use Victory
with React Native? Check out victory-native
Victory Native shares most of its code with Victory, and has a nearly identical api!
The victory
repo aggregates stable victory components that are developed in other repos. The victory
repo is only updated with new releases, but the following repos are under very active development.
victory-core
victory-chart
victory-pie
Please review our Code of Conduct before contributing.
For a detailed contribution guide, please see CONTRIBUTING in the project builder archetype.
# Clone the Victory repo
$ git clone git@github.com:FormidableLabs/victory.git
$ cd victory
# Run the demo app server
$ npm start
# Open the demo app
$ open http://localhost:3000
# Run checks (lint and tests)
$ npm test
Victory uses lank
for multi-repo development. Use a lank workflow to test changes in victory dependencies. Here's an example of setting up lank to test changes in victory-core
from victory-chart
First, make sure that all of your Victory repos are siblings in the same directory
# Install lank globally
$ npm install -g lank
Victory repos are already configured with appropriate .lankrc
and lank scripts. To test changes in victory-core
from victory-chart
:
# Run all commands from the root of `victory-chart`
$ cd victory-chart
# Run `lank link` to remove `victory-core` from node_modules
$ lank link
# Watch for changes to lanked repos. Leave this process running in its own terminal window
$ npm run lank-watch
# Run a dev server with your lanked repos. In a new terminal window...
$ npm run lank-run
Refresh your browser to pick up changes.
For more on the development environment, see DEVELOPMENT in the project builder archetype.
This project is in alpha release. We're hard at work fixing bugs and improving the API. Be prepared for breaking changes!
SEMVER Minor version bumps should be considered breaking changes until we hit v1.0.0. Patches can be considered safe.
Caveats git installs using npm 2 may fail in postinstall. If you are consuming Victory via git installs please use npm >=3.0.0
If you want to use Jest snapshot testing
with Victory, you may encounter a problem where the Jest snapshot changes every time, due to a randomly generated clipId
being used for a VictoryClipContainer
group component.
The solution to this is to set a static clipId
on your VictoryClipContainer
.
For example, when creating a VictoryLine
component, you can pass a groupComponent
prop:
<VictoryLine
groupComponent={<VictoryClipContainer clipId={1} />}
/>
Now the clipId
attached to your VictoryLine
component will always be the same, and your snapshot will not change with each test run.
FAQs
Data viz for React
The npm package victory receives a total of 90,005 weekly downloads. As such, victory popularity was classified as popular.
We found that victory demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 20 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.