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

@types/d3-axis

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-axis

TypeScript definitions for d3-axis

  • 3.0.6
  • 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
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/d3-axis?

The @types/d3-axis package provides TypeScript type definitions for the d3-axis module, which is part of the D3 (Data-Driven Documents) library. This package allows developers to use D3's axis component in TypeScript projects with type checking, enabling them to create and manipulate axes in SVG for data visualization with the assurance of type safety.

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

Creating an Axis

This code sample demonstrates how to create a bottom-oriented axis using a linear scale. The axis will map a domain of [0, 100] to a range of [0, 400] in the SVG.

import * as d3 from 'd3';

const scale = d3.scaleLinear().domain([0, 100]).range([0, 400]);
const axis = d3.axisBottom(scale);

Customizing Tick Values

This code sample shows how to customize the tick values on an axis. Instead of using the scale's automatic ticks, it specifies an array of tick values at 0, 50, and 100.

import * as d3 from 'd3';

const scale = d3.scaleLinear().domain([0, 100]).range([0, 400]);
const axis = d3.axisBottom(scale).tickValues([0, 50, 100]);

Formatting Tick Labels

This code sample illustrates how to format the tick labels on an axis. It uses d3.format to display the tick values as percentages with no decimal places.

import * as d3 from 'd3';

const scale = d3.scaleLinear().domain([0, 100]).range([0, 400]);
const axis = d3.axisBottom(scale).tickFormat(d3.format('.0%'));

Other packages similar to @types/d3-axis

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