What is victory-core?
The victory-core npm package is a part of the Victory library, which is a collection of composable React components for building interactive data visualizations. The core package provides essential utilities and components that are used across the Victory ecosystem.
What are victory-core's main functionalities?
Data Utilities
Victory-core provides utilities for formatting and manipulating data, which can be used to prepare data for visualization.
const { Data } = require('victory-core');
const data = [
{ x: 1, y: 2 },
{ x: 2, y: 3 },
{ x: 3, y: 5 }
];
const formattedData = Data.formatData(data);
console.log(formattedData);
Animation
Victory-core includes components for animating data changes, which can be used to create dynamic and interactive visualizations.
const { VictoryAnimation } = require('victory-core');
const React = require('react');
const { render } = require('react-dom');
const AnimatedComponent = () => (
<VictoryAnimation duration={1000} data={{ x: 10 }}>
{(newProps) => {
return <div>{newProps.x}</div>;
}}
</VictoryAnimation>
);
render(<AnimatedComponent />, document.getElementById('root'));
Themes
Victory-core provides theming capabilities, allowing users to apply consistent styles across their visualizations.
const { VictoryTheme } = require('victory-core');
const theme = VictoryTheme.grayscale;
console.log(theme);
Other packages similar to victory-core
recharts
Recharts is a composable charting library built on React components. It provides a wide range of chart types and is known for its simplicity and ease of use. Compared to victory-core, Recharts offers a more extensive set of pre-built chart components but may not be as flexible in terms of customization.
nivo
Nivo provides a rich set of data visualization components built on top of D3 and React. It offers a variety of chart types and is highly customizable. Nivo is similar to victory-core in terms of flexibility and customization but leverages D3 for more complex visualizations.
react-vis
React-vis is a library for data visualization developed by Uber. It provides a set of React components for creating common charts and graphs. React-vis is known for its simplicity and ease of integration with React applications. Compared to victory-core, react-vis may have fewer customization options but is easier to get started with.
VictoryCore
This package contains shared libraries and components for Victory.
- VictoryAnimation: Animation component
- VictoryLabel: Label component
- VictoryUtil: Supporting math and logic helper functions
Development
$ npm start
$ open http://localhost:3000
$ npm test
For more on the development environment, see DEVELOPMENT in the project builder archetype.
Contributing
Please see CONTRIBUTING in the project builder archetype.
IMPORTANT
This project is in a pre-release state. We're hard at work fixing bugs and improving the API. Be prepared for breaking changes!
31.0.0 (2018-11-10)
- #1177 Adds support for controlling
radius
, innerRadius
, cornerRadius
, padAngle
, sliceStartAngle
and sliceEndAngle
for each individual slice of a pie:
Details:
The Slice
primitive used by VictoryPie
now takes radius
, cornerRadius
, innerRadius
, padAngle
, sliceStartAngle
and sliceEndAngle
props. Each of these props may be given as number or a function of datum
and active
. padAngle
, radius
, cornerRadius
and innerRadius
will be passed down from props on VictoryBar
, but sliceStartAngle
and sliceEndAngle
must be defined directly on the Slice
instance, These values should be given in degrees. To make these values easier to use as functional props, startAngle
, endAngle
, and padAngle
(in degrees) are added to each datum
passed into Slice
. (If your data already has these properties they will not be overridden)
Breaking Changes
The Slice
primitive will still take a pathFunction
prop, but this prop will no longer be provided by VictoryPie
. This will not be a breaking change for most users. This will only affect users who were wrapping the Slice
component and making use of the pathFunction
prop provided by VictoryPie
Users who were providing their own pathFunction
prop to Slice
should not be effected.