npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

victory-composed

v0.0.1

Published

Top level composed component for Victory

Downloads

8

Readme


demo

Getting Started

victory-composed is a set of composed, pre-styled Victory components that can be used to display rich, interactive charts. Our theming system not only supports style based theming, but behavioral/compositional theming as well.

  1. Add victory-composed to your project

    npm install victory-composed --save

For React Native, you'll need victory-native and react-native-svg:

npm install victory-native victory-composed react-native-svg --save
react-native link react-native-svg
  1. Add your first victory-composed component:

    import React, { Component } from 'react';
    import { render } from 'react-dom';
    import { VictoryLineChart } from 'victory-composed';
    
    class MyLineChart extends Component {
     render() {
       return (
         <VictoryLineChart />
       );
     }
    }
    
    render(<MyLineChart />, document.getElementById('app'));
  2. Explore the API below and out the various possible components and configurations and their themes!

API Documentation

Common Props

The following is a list of common props shared by each chart, with the exception of VictoryPieChart where noted:

#####categories oneOfType(shape({ x: arrayOf(string), y: arrayOf(string) }), arrayOf(string))

The categories prop specifies how categorical data for a chart should be ordered. This prop should be given as an array of string values, or an object with these arrays of values specified for x and y. If this prop is not set, categorical data will be plotted in the order it was given in the data array.

Not applicable to VictoryPieChart

Examples: ["dogs", "cats", "mice"], { x: ["dogs","cats"], y: ["mice","birds"]}

--

#####domain oneOfType(shape({ x: arrayOf(number), y: arrayOf(number) }), arrayOf(number))

The domain prop describes the range of values your chart will include. This prop can be given as a array of the minimum and maximum expected values for your chart, or as an object that specifies separate arrays for x and y. If this prop is not provided, a domain will be calculated from data, or other available information.

Not applicable to VictoryPieChart

Examples: [-1, 1], {x: [0, 100], y: [0, 1]}

--

#####domainPadding oneOfType(shape({ x: number, y: number }), number))

The domainPadding prop specifies a number of pixels of padding to add to the beginning and end of a domain. This prop is useful for explicitly spacing ticks farther from the origin to prevent crowding. This prop should be given as an object with numbers specified for x and y.

Not applicable to VictoryPieChart

Examples: 20, { x: 5, y: 10 }

--

#####height number

The height props specifies the height of the svg viewBox of the chart container. This value should be given as a number of pixels.

--

#####subtitle string

The subtitle for your chart. This value should be a string.

--

#####theme object

This prop specifies which theme to use for your chart. See the themes section below for available themes and how to add them.

Example Themes.simple

--

#####title string

The title for your chart. This value should be a string.

--

#####width number

The width props specifies the width of the svg viewBox of the chart container. This value should be given as a number of pixels.

--

#####xAxis object

This prop specifies a set of props to pass to the x axis. Valid props can be found here: VictoryAxis

Not applicable to VictoryPieChart

Example { name: "test" }

--

#####yAxis object

This prop specifies a set of props to pass to the y axis. Valid props can be found here: VictoryAxis

Not applicable to VictoryPieChart

Example { scale: "time" }


VictoryAreaChart

--

#####interpolation string

The interpolation prop determines how data points should be connected when plotting a line. The following values are valid:

"basis", "basisClosed", "basisOpen", "bundle", "cardinal", "cardinalClosed", "cardinalOpen", "catmullRom", "catmullRomClosed", "catmullRomOpen", "linear", "linearClosed", "monotoneX", "monotoneY", "natural", "radial", "step", "stepAfter", "stepBefore"

--

#####series arrayOf(object)

The series prop allows you to provide data series to your chart. Each object in the series array is representative of a subset of the properties found here: VictoryArea

The series child object shape is as follows:

{
  data: oneOfType(array, object),
  samples: number,
  style: object,
  x: oneOfType(string, func),
  y: oneOfType(string, func)
}

Example [{ data: [{ x: 0, y: 1 }] ] }, { data: [ [2,3], [4 ,5] ] }]

--

#####stacked bool

The stacked prop is a boolean value that determines whether to stack your area chart series.


VictoryBarChart

--

#####horizontal bool

The horizontal prop is a boolean value that determines whether to display your bar chart series horizontally.

--

#####labels func

The labels prop defines labels that will appear above each bar in your bar chart. This prop should be given as a function of data.

Example (datum) => datum.y

--

#####offset number

The offset prop on VictoryGroup controls the spacing between each series of bars in a group.

--

#####series arrayOf(object)

The series prop allows you to provide data series to your chart. Each object in the series array is representative of a subset of the properties found here: VictoryBar

The series child object shape is as follows:

{
  data: oneOfType(array, object),
  style: object,
  x: oneOfType(string, func),
  y: oneOfType(string, func)
}

Example [{ data: [{ x: 0, y: 1 }] ] }, { data: [ [2,3], [4 ,5] ] }]

--

#####stacked bool

The stacked prop is a boolean value that determines whether to stack your bar chart series.


VictoryLineChart

#####interpolation string

The interpolation prop determines how data points should be connected when plotting a line. The following values are valid:

"basis", "basisClosed", "basisOpen", "bundle", "cardinal", "cardinalClosed", "cardinalOpen", "catmullRom", "catmullRomClosed", "catmullRomOpen", "linear", "linearClosed", "monotoneX", "monotoneY", "natural", "radial", "step", "stepAfter", "stepBefore"

--

#####series arrayOf(object)

The series prop allows you to provide data series to your chart. Each object in the series array is representative of a subset of the properties found here: VictoryLine

The series child object shape is as follows:

{
  data: oneOfType(array, object),
  samples: number,
  style: object,
  x: oneOfType(string, func),
  y: oneOfType(string, func)
}

Example [{ data: [{ x: 0, y: 1 }] ] }, { data: [ [2,3], [4 ,5] ] }]


VictoryScatterChart

#####labels func

The labels prop defines labels that will appear above each bar in your bar chart. This prop should be given as a function of data.

Example (datum) => datum.y

--

#####series arrayOf(object)

The series prop allows you to provide data series to your chart. Each object in the series array is representative of a subset of the properties found here: VictoryScatter

The series child object shape is as follows:

{
  bubbleProperty: string,
  data: oneOfType(array, object),
  samples: number,
  size: number,
  symbol: oneOfType(string, func),
  style: object,
  x: oneOfType(string, func),
  y: oneOfType(string, func)
}

Example [{ data: [{ x: 0, y: 1 }] ] }, { data: [ [2,3], [4 ,5] ] }]

--

#####size oneOfType(number, func)

The size prop determines how to scale each data point

Example 3

--

#####symbol oneOfType(string, func)

The symbol prop determines which symbol should be drawn to represent data points.

Valid string values: "circle", "diamond", "plus", "square", "star", "triangleDown", "triangleUp"

Example "circle"


VictoryPieChart

#####cornerRadius number

Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie


#####endAngle number

The overall end angle of the pie in degrees. This prop is used in conjunction with startAngle to create a pie that spans only a segment of a circle.


#####innerRadius number

When creating a donut chart, this prop determines the number of pixels between the center of the chart and the inner edge of a donut. When this prop is set to zero a regular pie chart is rendered.


#####labels oneOfType(arrayOf(string), func)

The labels prop defines labels that will appear above each bar in your bar chart. This prop should be given as a function of data or an array of strings.

Example (datum) => datum.y

--

#####padAngle number

The padAngle prop determines the amount of separation between adjacent data slices in number of degrees

--

#####startAngle number

The overall start angle of the pie in degrees. This prop is used in conjunction with endAngle to create a pie that spans only a segment of a circle.


Themes

victory-composed has a set of beautiful preset themes ready to go. We default to the simple theme by default, but if you want to try out the whole gang, here is how:

import { VictoryLineChart, Themes } from "victory-composed";

class MyChart extends Component {
  render() {
    return (
      <VictoryLineChart theme={Themes.dark} />
    )
  }
}

Right now we have 4 themes you can choose from:

bright - A bright, fun theme.

bright

simple - A simple, yet elegant theme.

simple

dark - Uh oh who turned the lights out. A dark theme for your charts.

dark

danceparty - Use this one carefully. You might have too much fun.

danceparty

Keep your eyes peeled, there are more themes on the way!

Development

# Run the demo app server
$ npm start

# Open the demo app
$ open http://localhost:3000

# Run tests
$ npm test

For more on the development environment, see DEVELOPMENT in the project builder archetype.

Contributing

Please review our Code of Conduct before contributing.

For a detailed contribution guide, 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!