Skip to content

Instantly share code, notes, and snippets.

@oscarmorrison
Last active March 6, 2024 12:50
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oscarmorrison/efa6f1213cc7bc5f410993d4139f0007 to your computer and use it in GitHub Desktop.
Save oscarmorrison/efa6f1213cc7bc5f410993d4139f0007 to your computer and use it in GitHub Desktop.
Modularly import only the D3.js modules you require
import { line, curve, curveCatmullRom } from "d3-shape";
import { scaleTime, scaleLinear } from "d3-scale";
import { axisBottom, axisLeft } from 'd3-axis';
import { timeParse, isoFormat } from "d3-time-format";
import { select } from "d3-selection";
import { extent, max, min } from "d3-array";
export default {
line: line,
scaleTime: scaleTime,
scaleLinear: scaleLinear,
axisBottom: axisBottom,
axisLeft: axisLeft,
timeParse: timeParse,
isoFormat: isoFormat,
select: select,
extent: extent,
min: min,
max: max,
};
import d3 from './d3Importer.js';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment