D3: .axisLeft, .scaleLinear: Axis Left with Inverted Labels

Forked script below was converted from D3.js v3 to v4.

nick3499
1 min readMar 1, 2017
  • .axisLeft() and .scaleLinear() are v4 functions which require the .v4.min.js library.
  • .attrs({}) is a v4 function which contains multiple attribute tuples and requires the d3-selection-multi.v1.min.js plugin, e.g. .attrs({width: width, height: height}).
  • axisNodes.selectAll() calls were commented out because v4 ignores them. Invert labels from descending to ascending by changing .domain([0, maxValue]) to .domain([maxValue, 0]).

Adapted script above is based on v4 and original script below is based on v3.

D3.js 3.5.17 seems to have a similar existence to Python 2.7.13 as a version maintained mainly to avoid alienating users.

--

--

nick3499
nick3499

Written by nick3499

coder of JavaScript and Python

No responses yet