0.4.2 • Published 4 months ago

@wings-j/d3-utils v0.4.2

Weekly downloads
-
License
GPL-3.0-or-later
Repository
-
Last release
4 months ago

Utils for using d3 easily.

Based on the d3@7.0.0

Install

npm install @wings-j/d3-utils

Usage

import { install } from '@wings-j/d3-utils'
import * as d3 from 'd3'

install(d3)

Tool methods are injected into the d3 prototype.

API

Selection.attrs

Setting several attributes at the same time.

d3.select('selector').attrs({
  id: 'id',
  title: 'title'
})

Selection.classeds

Setting several classes at the same time.

d3.select('selector').classed({
  a: true,
  b: false,
  c: true
})

Selection.styles

Setting several styles at the same time.

d3.select('selector').styles({
  color: 'red',
  'font-weight': 'bold'
})

Selection.properties

Setting several properties at the same time.

d3.select('selector').properties({
  value: 'value'
})

Selection.translate

Setting the translate part of the transform attribute without affecting other parts.

d3.select('selector').translate(0, 0)

Selection.scale

Setting the scale part of the transform attribute without affecting other parts.

d3.select('selector').scale(1, 1)

Selection.rotate

Setting the rotate part of the transform attribute without affecting other parts.

d3.select('selector').rotate(0, 0, 0)

container

Creating a container svg into a DOM element. The svg has the same width and height with the DOM element.

import { Container } from 'd3-utils'

let $svg = Container('selector')

zoom

Create a zoomed g element.

import { Zoom } from 'd3-utils'

let $zoom = Zoom($svg)
0.4.1

4 months ago

0.4.0

4 months ago

0.4.2

4 months ago

0.3.0

5 months ago

0.3.1

5 months ago

0.2.5

5 months ago

0.2.4

5 months ago

0.2.1

1 year ago

0.1.2

2 years ago

0.2.0

1 year ago

0.1.1

2 years ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.0

3 years ago