You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@vx/axis

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/axis

vx axis

0.0.199
latest
Source
npmnpm
Version published
Maintainers
3
Created

What is @vx/axis?

@vx/axis is a part of the vx (now known as visx) collection of low-level visualization components for React. It provides a set of components to create and customize axes for data visualizations, such as charts and graphs. These components are highly customizable and can be used to create both simple and complex axis configurations.

What are @vx/axis's main functionalities?

Basic Axis

This code demonstrates how to create a basic bottom axis using the @vx/axis package. The `AxisBottom` component is used along with a linear scale to render the axis.

import { AxisBottom } from '@vx/axis';
import { scaleLinear } from '@vx/scale';

const xScale = scaleLinear({ domain: [0, 100], range: [0, 500] });

<svg width={500} height={50}>
  <AxisBottom scale={xScale} top={0} left={0} />
</svg>

Custom Tick Format

This code shows how to create a left axis with custom tick formatting. The `tickFormat` prop is used to format the tick values as percentages.

import { AxisLeft } from '@vx/axis';
import { scaleLinear } from '@vx/scale';

const yScale = scaleLinear({ domain: [0, 100], range: [500, 0] });

<svg width={50} height={500}>
  <AxisLeft
    scale={yScale}
    tickFormat={(value) => `${value}%`}
    top={0}
    left={0}
  />
</svg>

Custom Tick Labels

This example demonstrates how to create a top axis with custom tick labels. The `tickLabelProps` prop is used to customize the appearance of the tick labels.

import { AxisTop } from '@vx/axis';
import { scaleBand } from '@vx/scale';

const xScale = scaleBand({ domain: ['A', 'B', 'C'], range: [0, 300] });

<svg width={300} height={50}>
  <AxisTop
    scale={xScale}
    tickLabelProps={() => ({
      fill: 'blue',
      fontSize: 12,
      textAnchor: 'middle'
    })}
    top={0}
    left={0}
  />
</svg>

Other packages similar to @vx/axis

Keywords

vx

FAQs

Package last updated on 09 Sep 2020

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