๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

@antv/scale

Package Overview
Dependencies
Maintainers
68
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/scale

Toolkit for mapping abstract data into visual representation.

0.4.16
latest
Source
npm
Version published
Weekly downloads
217K
9.45%
Maintainers
68
Weekly downloads
ย 
Created

What is @antv/scale?

@antv/scale is a JavaScript library for creating and managing scales, which are functions that map a domain of data values to a range of visual values. It is commonly used in data visualization to ensure that data is represented accurately and proportionally.

What are @antv/scale's main functionalities?

Linear Scale

Linear scales map a continuous domain to a continuous range. This is useful for data that is evenly distributed.

const { Linear } = require('@antv/scale');
const scale = new Linear({
  domain: [0, 100],
  range: [0, 1]
});
console.log(scale.map(50)); // 0.5

Ordinal Scale

Ordinal scales map a discrete domain to a discrete range. This is useful for categorical data.

const { Ordinal } = require('@antv/scale');
const scale = new Ordinal({
  domain: ['A', 'B', 'C'],
  range: [0, 1, 2]
});
console.log(scale.map('B')); // 1

Time Scale

Time scales map a time domain to a continuous range. This is useful for time-series data.

const { Time } = require('@antv/scale');
const scale = new Time({
  domain: [new Date(2020, 0, 1), new Date(2020, 11, 31)],
  range: [0, 1]
});
console.log(scale.map(new Date(2020, 5, 15))); // 0.5

Log Scale

Log scales map a logarithmic domain to a continuous range. This is useful for data that spans several orders of magnitude.

const { Log } = require('@antv/scale');
const scale = new Log({
  domain: [1, 100],
  range: [0, 1]
});
console.log(scale.map(10)); // 0.5

Other packages similar to @antv/scale

Keywords

antv

FAQs

Package last updated on 13 May 2024

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