Socket
Socket
Sign inDemoInstall

@antv/scale

Package Overview
Dependencies
8
Maintainers
67
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @antv/scale

Toolkit for mapping abstract data into visual representation.


Version published
Weekly downloads
159K
increased by3.32%
Maintainers
67
Install size
2.30 MB
Created
Weekly downloads
 

Readme

Source

@antv/scale

Toolkit for mapping abstract data into visual representation. Living Demo · 中文文档

scale mapping

Build Status Coverage Status npm Version npm Download npm License

✨ Features

  • Powerful: Ability to customize tickMethod are offered with abundant kinds of scales.
  • High performance: Use different methods to cache some state of scales to improve performance.
  • Fully embrace TypeScript: All code are written in TypeScript and complete type definition files are provided.

scale examples

📦 Installation

$ npm install @antv/scale

🔨 Getting Started

  • Basic usage
import { Linear, LinearOptions } from '@antv/scale';

const options: LinearOptions = {
  domain: [0, 10],
  range: [0, 100],
};
const x = new Linear(options);

x.map(2); // 20
x.invert(20); // 2
x.getTicks(); // [0, 2.5, 5, 7.5, 10]
  • Customize tickMethod
import { Linear } from '@antv/scale';

const x = new Linear({
  domain: [0, 10],
  range: [0, 100],
  tickCount: 3,
  tickMethod: () => [0, 5, 10],
});

x.getTicks(); // [0, 5, 10]

📮 Contribution

$ git clone git@github.com:antvis/scale.git

$ cd scale

$ npm i

$ npm t

Then send a pull request after coding.

📄 License

MIT@AntV.

Keywords

FAQs

Last updated on 20 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc