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

@types/d3-scale

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-scale

TypeScript definitions for d3-scale

  • 4.0.8
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.1M
decreased by-7.33%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-scale?

The @types/d3-scale package provides TypeScript type definitions for the d3-scale library, which is part of D3.js, a JavaScript library for producing dynamic, interactive data visualizations in web browsers. This package helps developers by enabling type checking and IntelliSense support in TypeScript projects using d3-scale.

What are @types/d3-scale's main functionalities?

Creating Linear Scales

Linear scales are a type of quantitative scale that create a linear mapping from an input domain to an output range. This is useful for scaling a dataset for graphical representation.

import { scaleLinear } from 'd3-scale';
const linearScale = scaleLinear().domain([0, 100]).range([0, 1]);
console.log(linearScale(50)); // Output: 0.5

Creating Ordinal Scales

Ordinal scales map a set of named categories to an output range. This is particularly useful for assigning colors or other styles based on categorical data.

import { scaleOrdinal } from 'd3-scale';
const colorScale = scaleOrdinal().domain(['apple', 'banana', 'cherry']).range(['red', 'yellow', 'purple']);
console.log(colorScale('banana')); // Output: yellow

Creating Time Scales

Time scales are used for time-based data, mapping dates (Date objects) from an input domain to a numeric range. This is useful for creating time-based charts like timelines or Gantt charts.

import { scaleTime } from 'd3-scale';
const timeScale = scaleTime().domain([new Date(2020, 0, 1), new Date(2020, 11, 31)]).range([0, 100]);
console.log(timeScale(new Date(2020, 6, 1))); // Output: 50

Other packages similar to @types/d3-scale

FAQs

Package last updated on 07 Nov 2023

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