Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@visx/scale

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/scale

visx scale

  • 2.17.0-alpha.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
86K
decreased by-82.55%
Maintainers
4
Weekly downloads
 
Created

What is @visx/scale?

@visx/scale is a part of the VisX library, which provides a collection of reusable low-level visualization components for React. The @visx/scale package specifically deals with creating and managing scales, which are functions that map data values to visual values. These scales are essential for creating visualizations like charts and graphs.

What are @visx/scale's main functionalities?

Linear Scale

Creates a linear scale that maps a domain of [0, 100] to a range of [0, 500]. This is useful for creating continuous scales for visualizations like line charts.

const scaleLinear = require('@visx/scale').scaleLinear;
const linear = scaleLinear({
  domain: [0, 100],
  range: [0, 500]
});
console.log(linear(50)); // 250

Band Scale

Creates a band scale that maps categorical data to a range. This is useful for creating bar charts where each category needs to be spaced evenly.

const scaleBand = require('@visx/scale').scaleBand;
const band = scaleBand({
  domain: ['A', 'B', 'C'],
  range: [0, 300],
  padding: 0.1
});
console.log(band('B')); // 110

Time Scale

Creates a time scale that maps dates to a range. This is useful for visualizing time series data.

const scaleTime = require('@visx/scale').scaleTime;
const time = scaleTime({
  domain: [new Date(2020, 0, 1), new Date(2020, 11, 31)],
  range: [0, 365]
});
console.log(time(new Date(2020, 5, 15))); // 165

Logarithmic Scale

Creates a logarithmic scale that maps a domain to a range. This is useful for visualizing data that spans several orders of magnitude.

const scaleLog = require('@visx/scale').scaleLog;
const log = scaleLog({
  domain: [1, 100],
  range: [0, 2]
});
console.log(log(10)); // 1

Other packages similar to @visx/scale

Keywords

FAQs

Package last updated on 21 Dec 2022

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