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

d3-table-cards

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-table-cards

Table/Cards views using D3.js for animated transitions.

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

D3-Table-Cards · GitHub license npm version

Example of using D3.js for transformations between table and cards views, and animated transitions while sorting elements or resizing the browser.

Check out the demo.

screenshot

This code uses HTML (with absolute positioning) rather than SVG, and has no dependencies beside D3.js.

The table and cards layouts are configurable.


const layoutInfo = {
	table: {
		// row position & size
		top: (d, i) => 40+i*31+"px",
		left: "0px",
		height: "30px",
		width: "594px",
		// row border-radius
		radius: 0,
		// table header
		headerOpacity: 1,
		headerLeft: "0px",
		// column 1
		c1Top: "5px",
		c1Left: "8px",
		c1FontSize: "16px",
		// column 2
		c2Top: "5px",
		c2Left: "200px",
	},
	cards: {
		// card position & size
		top: (d, i) => Math.floor(i/cardsPerRow)*94+"px",
		left: (d, i) => (i%cardsPerRow)*210+"px",
		height: "84px",
		width: "200px",
		// card border-radius
		radius: "4px",
		// table header (hidden)
		headerOpacity: 0,
		headerLeft: "-650px",
		// line 1
		c1Top: "10px",
		c1Left: "10px",
		c1FontSize: "18px",
		// line 2
		c2Top: "38px",
		c2Left: "10px",
	}
};

Note: The same result can also be achieved using CSS transitions instead of D3.

My other D3 animations: meet-the-fans and d3-dual-range-slider.

(c) 2023 Olivier Giulieri

Keywords

FAQs

Package last updated on 06 Dec 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