Socket
Socket
Sign inDemoInstall

@visx/shape

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/shape

visx shape


Version published
Weekly downloads
464K
decreased by-4.76%
Maintainers
4
Weekly downloads
 
Created

What is @visx/shape?

@visx/shape is a part of the VisX library, which provides a collection of low-level visualization components for building custom visualizations in React. The @visx/shape package specifically focuses on providing a variety of shape components such as bars, lines, areas, and more, which can be used to create complex and highly customizable charts and graphs.

What are @visx/shape's main functionalities?

Bar

The Bar component is used to create bar charts. The code sample demonstrates how to render a simple bar chart using the Bar component, where each bar's height is determined by the data values.

import { Bar } from '@visx/shape';

const MyBarChart = ({ data }) => (
  <svg width={500} height={500}>
    {data.map((d, i) => (
      <Bar
        key={`bar-${i}`}
        x={i * 30}
        y={500 - d.value}
        width={25}
        height={d.value}
        fill="teal"
      />
    ))}
  </svg>
);

LinePath

The LinePath component is used to create line charts. The code sample demonstrates how to render a simple line chart using the LinePath component, where the line's path is determined by the data values.

import { LinePath } from '@visx/shape';

const MyLineChart = ({ data }) => (
  <svg width={500} height={500}>
    <LinePath
      data={data}
      x={(d, i) => i * 30}
      y={d => 500 - d.value}
      stroke="blue"
      strokeWidth={2}
    />
  </svg>
);

AreaClosed

The AreaClosed component is used to create area charts. The code sample demonstrates how to render a simple area chart using the AreaClosed component, where the area is filled based on the data values.

import { AreaClosed } from '@visx/shape';

const MyAreaChart = ({ data }) => (
  <svg width={500} height={500}>
    <AreaClosed
      data={data}
      x={(d, i) => i * 30}
      y={d => 500 - d.value}
      yScale={d => 500 - d}
      fill="lightblue"
      stroke="blue"
    />
  </svg>
);

Other packages similar to @visx/shape

Keywords

FAQs

Package last updated on 12 Mar 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc