Skip to content

What is D3?

D3 (or D3.js) is a free, open-source JavaScript library for visualizing data. Its low-level approach built on web standards offers unparalleled flexibility in authoring dynamic, data-driven graphics. For more than a decade D3 has powered groundbreaking and award-winning visualizations, become a foundational building block of higher-level chart libraries, and fostered a vibrant community of data practitioners around the world.

D3 “slingshotted the field into growth, diversification and creativity that has been unprecedented” and “changed how millions of data visualizations are created across newsrooms, websites, and personal portfolios,” remarked the Information is Beautiful 2022 Test of Time Award. The IEEE VIS 2021 Test of Time Award noted, “By creating a framework that was compelling and easy for web developers to use to author interactive visualizations, the authors have undeniably helped to bring data visualization to the mainstream. [D3] is a cornerstone contribution to this conference specifically and more generally to the success of our field as a whole.”

D3 was created by Mike Bostock in 2011. Mike co-authored the D3 paper with Jeff Heer and Vadim Ogievetsky at Stanford. Jason Davies made major contributions to D3 from 2011 to 2013, most notably to D3’s geographic projection system. Philippe Rivière has been a major contributor to D3 and its documentation since 2016. Over the years, countless kind individuals have contributed to D3 by sharing code and ideas, by teaching and answering questions, and by bringing people together to further the practice of visualization. Mike and Philippe now maintain D3 and Observable Plot at Observable.

D3 is a low-level toolbox

D3 is not a charting library in the traditional sense. It has no concept of “charts”. When you visualize data with D3, you compose a variety of primitives.

To make a stacked area chart, you might use

That’s a lot to take in, right? But take a deep breath — you don’t have to learn everything at once. Each piece can be used independently, so you can learn them individually before you fit them together. D3 is not a single monolith but rather a suite of 30 discrete libraries (or “modules”). We bundle these modules together for convenience rather than necessity so your tools are within reach as you iterate on your design.

What all’s in the D3 toolbox? We recommend exploring the documentation and examples to get a sense of what’s relevant to you.

/D3/D3/Introduction/D3/Visualization/D3/Animation/D3/Interaction/D3/Data/D3/Introduction/What is D3?/D3/Introduction/What is D3?/D3/Introduction/Getting started/D3/Introduction/Getting started/D3/Introduction/API index/D3/Introduction/API index/D3/Introduction/Examples/D3/Introduction/Examples/D3/Visualization/d3-axis/D3/Visualization/d3-axis/D3/Visualization/d3-chord/D3/Visualization/d3-chord/D3/Visualization/d3-color/D3/Visualization/d3-color/D3/Visualization/d3-interpolate/D3/Visualization/d3-interpolate/D3/Visualization/d3-contour/D3/Visualization/d3-contour/D3/Visualization/d3-delaunay/D3/Visualization/d3-delaunay/D3/Visualization/d3-force/D3/Visualization/d3-force/D3/Visualization/d3-geo/D3/Visualization/d3-geo/D3/Visualization/d3-hierarchy/D3/Visualization/d3-hierarchy/D3/Visualization/d3-path/D3/Visualization/d3-path/D3/Visualization/d3-polygon/D3/Visualization/d3-polygon/D3/Visualization/d3-quadtree/D3/Visualization/d3-quadtree/D3/Visualization/d3-scale/D3/Visualization/d3-scale/D3/Visualization/d3-scale-chromatic/D3/Visualization/d3-scale-chromatic/D3/Visualization/d3-selection/D3/Visualization/d3-selection/D3/Visualization/d3-shape/D3/Visualization/d3-shape/D3/Animation/d3-ease/D3/Animation/d3-ease/D3/Animation/d3-timer/D3/Animation/d3-timer/D3/Animation/d3-transition/D3/Animation/d3-transition/D3/Interaction/d3-brush/D3/Interaction/d3-brush/D3/Interaction/d3-dispatch/D3/Interaction/d3-dispatch/D3/Interaction/d3-drag/D3/Interaction/d3-drag/D3/Interaction/d3-zoom/D3/Interaction/d3-zoom/D3/Data/d3-array/D3/Data/d3-array/D3/Data/d3-dsv/D3/Data/d3-dsv/D3/Data/d3-fetch/D3/Data/d3-fetch/D3/Data/d3-format/D3/Data/d3-format/D3/Data/d3-random/D3/Data/d3-random/D3/Data/d3-time/D3/Data/d3-time/D3/Data/d3-time-format/D3/Data/d3-time-format/D3/Visualization/d3-chord/Chords/D3/Visualization/d3-chord/Chords/D3/Visualization/d3-chord/Ribbons/D3/Visualization/d3-chord/Ribbons/D3/Visualization/d3-interpolate/Value interpolation/D3/Visualization/d3-interpolate/Value interpolation/D3/Visualization/d3-interpolate/Color interpolation/D3/Visualization/d3-interpolate/Color interpolation/D3/Visualization/d3-interpolate/Transform interpolation/D3/Visualization/d3-interpolate/Transform interpolation/D3/Visualization/d3-interpolate/Zoom interpolation/D3/Visualization/d3-interpolate/Zoom interpolation/D3/Visualization/d3-contour/Contour polygons/D3/Visualization/d3-contour/Contour polygons/D3/Visualization/d3-contour/Density estimation/D3/Visualization/d3-contour/Density estimation/D3/Visualization/d3-delaunay/Delaunay triangulations/D3/Visualization/d3-delaunay/Delaunay triangulations/D3/Visualization/d3-delaunay/Voronoi diagrams/D3/Visualization/d3-delaunay/Voronoi diagrams/D3/Visualization/d3-force/Force simulations/D3/Visualization/d3-force/Force simulations/D3/Visualization/d3-force/Center force/D3/Visualization/d3-force/Center force/D3/Visualization/d3-force/Collide force/D3/Visualization/d3-force/Collide force/D3/Visualization/d3-force/Link force/D3/Visualization/d3-force/Link force/D3/Visualization/d3-force/Many-body force/D3/Visualization/d3-force/Many-body force/D3/Visualization/d3-force/Position forces/D3/Visualization/d3-force/Position forces/D3/Visualization/d3-geo/Paths/D3/Visualization/d3-geo/Paths/D3/Visualization/d3-geo/Projections/D3/Visualization/d3-geo/Projections/D3/Visualization/d3-geo/Streams/D3/Visualization/d3-geo/Streams/D3/Visualization/d3-geo/Spherical shapes/D3/Visualization/d3-geo/Spherical shapes/D3/Visualization/d3-geo/Spherical math/D3/Visualization/d3-geo/Spherical math/D3/Visualization/d3-hierarchy/Hierarchies/D3/Visualization/d3-hierarchy/Hierarchies/D3/Visualization/d3-hierarchy/Stratify/D3/Visualization/d3-hierarchy/Stratify/D3/Visualization/d3-hierarchy/Tree/D3/Visualization/d3-hierarchy/Tree/D3/Visualization/d3-hierarchy/Cluster/D3/Visualization/d3-hierarchy/Cluster/D3/Visualization/d3-hierarchy/Partition/D3/Visualization/d3-hierarchy/Partition/D3/Visualization/d3-hierarchy/Pack/D3/Visualization/d3-hierarchy/Pack/D3/Visualization/d3-hierarchy/Treemap/D3/Visualization/d3-hierarchy/Treemap/D3/Visualization/d3-scale/Linear scales/D3/Visualization/d3-scale/Linear scales/D3/Visualization/d3-scale/Time scales/D3/Visualization/d3-scale/Time scales/D3/Visualization/d3-scale/Pow scales/D3/Visualization/d3-scale/Pow scales/D3/Visualization/d3-scale/Log scales/D3/Visualization/d3-scale/Log scales/D3/Visualization/d3-scale/Symlog scales/D3/Visualization/d3-scale/Symlog scales/D3/Visualization/d3-scale/Ordinal scales/D3/Visualization/d3-scale/Ordinal scales/D3/Visualization/d3-scale/Band scales/D3/Visualization/d3-scale/Band scales/D3/Visualization/d3-scale/Point scales/D3/Visualization/d3-scale/Point scales/D3/Visualization/d3-scale/Sequential scales/D3/Visualization/d3-scale/Sequential scales/D3/Visualization/d3-scale/Diverging scales/D3/Visualization/d3-scale/Diverging scales/D3/Visualization/d3-scale/Quantile scales/D3/Visualization/d3-scale/Quantile scales/D3/Visualization/d3-scale/Quantize scales/D3/Visualization/d3-scale/Quantize scales/D3/Visualization/d3-scale/Threshold scales/D3/Visualization/d3-scale/Threshold scales/D3/Visualization/d3-scale-chromatic/Categorical schemes/D3/Visualization/d3-scale-chromatic/Categorical schemes/D3/Visualization/d3-scale-chromatic/Cyclical schemes/D3/Visualization/d3-scale-chromatic/Cyclical schemes/D3/Visualization/d3-scale-chromatic/Diverging schemes/D3/Visualization/d3-scale-chromatic/Diverging schemes/D3/Visualization/d3-scale-chromatic/Sequential schemes/D3/Visualization/d3-scale-chromatic/Sequential schemes/D3/Visualization/d3-selection/Selecting elements/D3/Visualization/d3-selection/Selecting elements/D3/Visualization/d3-selection/Modifying elements/D3/Visualization/d3-selection/Modifying elements/D3/Visualization/d3-selection/Joining data/D3/Visualization/d3-selection/Joining data/D3/Visualization/d3-selection/Handling events/D3/Visualization/d3-selection/Handling events/D3/Visualization/d3-selection/Control flow/D3/Visualization/d3-selection/Control flow/D3/Visualization/d3-selection/Local variables/D3/Visualization/d3-selection/Local variables/D3/Visualization/d3-selection/Namespaces/D3/Visualization/d3-selection/Namespaces/D3/Visualization/d3-shape/Arcs/D3/Visualization/d3-shape/Arcs/D3/Visualization/d3-shape/Areas/D3/Visualization/d3-shape/Areas/D3/Visualization/d3-shape/Curves/D3/Visualization/d3-shape/Curves/D3/Visualization/d3-shape/Lines/D3/Visualization/d3-shape/Lines/D3/Visualization/d3-shape/Links/D3/Visualization/d3-shape/Links/D3/Visualization/d3-shape/Pies/D3/Visualization/d3-shape/Pies/D3/Visualization/d3-shape/Stacks/D3/Visualization/d3-shape/Stacks/D3/Visualization/d3-shape/Symbols/D3/Visualization/d3-shape/Symbols/D3/Visualization/d3-shape/Radial areas/D3/Visualization/d3-shape/Radial areas/D3/Visualization/d3-shape/Radial lines/D3/Visualization/d3-shape/Radial lines/D3/Visualization/d3-shape/Radial links/D3/Visualization/d3-shape/Radial links/D3/Animation/d3-transition/Selecting elements/D3/Animation/d3-transition/Selecting elements/D3/Animation/d3-transition/Modifying elements/D3/Animation/d3-transition/Modifying elements/D3/Animation/d3-transition/Timing/D3/Animation/d3-transition/Timing/D3/Animation/d3-transition/Control flow/D3/Animation/d3-transition/Control flow/D3/Data/d3-array/Adding numbers/D3/Data/d3-array/Adding numbers/D3/Data/d3-array/Binning data/D3/Data/d3-array/Binning data/D3/Data/d3-array/Bisecting data/D3/Data/d3-array/Bisecting data/D3/Data/d3-array/Blurring data/D3/Data/d3-array/Blurring data/D3/Data/d3-array/Grouping data/D3/Data/d3-array/Grouping data/D3/Data/d3-array/Interning values/D3/Data/d3-array/Interning values/D3/Data/d3-array/Set operations/D3/Data/d3-array/Set operations/D3/Data/d3-array/Sorting data/D3/Data/d3-array/Sorting data/D3/Data/d3-array/Summarizing data/D3/Data/d3-array/Summarizing data/D3/Data/d3-array/Ticks/D3/Data/d3-array/Ticks/D3/Data/d3-array/Transforming data/D3/Data/d3-array/Transforming data/D3/Visualization/d3-geo/Projections/Azimuthal projections/D3/Visualization/d3-geo/Projections/Azimuthal projections/D3/Visualization/d3-geo/Projections/Conic projections/D3/Visualization/d3-geo/Projections/Conic projections/D3/Visualization/d3-geo/Projections/Cylindrical projections/D3/Visualization/d3-geo/Projections/Cylindrical projectionsWhat is D3?/D3/Introduction/What is D3?What is D3?/D3/Introduction/What is D3?Getting started/D3/Introduction/Getting startedGetting started/D3/Introduction/Getting startedAPI index/D3/Introduction/API indexAPI index/D3/Introduction/API indexExamples/D3/Introduction/ExamplesExamples/D3/Introduction/Examplesd3-axis/D3/Visualization/d3-axisd3-axis/D3/Visualization/d3-axisd3-color/D3/Visualization/d3-colord3-color/D3/Visualization/d3-colord3-path/D3/Visualization/d3-pathd3-path/D3/Visualization/d3-pathd3-polygon/D3/Visualization/d3-polygond3-polygon/D3/Visualization/d3-polygond3-quadtree/D3/Visualization/d3-quadtreed3-quadtree/D3/Visualization/d3-quadtreed3-ease/D3/Animation/d3-eased3-ease/D3/Animation/d3-eased3-timer/D3/Animation/d3-timerd3-timer/D3/Animation/d3-timerd3-brush/D3/Interaction/d3-brushd3-brush/D3/Interaction/d3-brushd3-dispatch/D3/Interaction/d3-dispatchd3-dispatch/D3/Interaction/d3-dispatchd3-drag/D3/Interaction/d3-dragd3-drag/D3/Interaction/d3-dragd3-zoom/D3/Interaction/d3-zoomd3-zoom/D3/Interaction/d3-zoomd3-dsv/D3/Data/d3-dsvd3-dsv/D3/Data/d3-dsvd3-fetch/D3/Data/d3-fetchd3-fetch/D3/Data/d3-fetchd3-format/D3/Data/d3-formatd3-format/D3/Data/d3-formatd3-random/D3/Data/d3-randomd3-random/D3/Data/d3-randomd3-time/D3/Data/d3-timed3-time/D3/Data/d3-timed3-time-format/D3/Data/d3-time-formatd3-time-format/D3/Data/d3-time-formatChords/D3/Visualization/d3-chord/ChordsChords/D3/Visualization/d3-chord/ChordsRibbons/D3/Visualization/d3-chord/RibbonsRibbons/D3/Visualization/d3-chord/RibbonsValue interpolation/D3/Visualization/d3-interpolate/Value interpolationValue interpolation/D3/Visualization/d3-interpolate/Value interpolationColor interpolation/D3/Visualization/d3-interpolate/Color interpolationColor interpolation/D3/Visualization/d3-interpolate/Color interpolationTransform interpolation/D3/Visualization/d3-interpolate/Transform interpolationTransform interpolation/D3/Visualization/d3-interpolate/Transform interpolationZoom interpolation/D3/Visualization/d3-interpolate/Zoom interpolationZoom interpolation/D3/Visualization/d3-interpolate/Zoom interpolationContour polygons/D3/Visualization/d3-contour/Contour polygonsContour polygons/D3/Visualization/d3-contour/Contour polygonsDensity estimation/D3/Visualization/d3-contour/Density estimationDensity estimation/D3/Visualization/d3-contour/Density estimationDelaunay triangulations/D3/Visualization/d3-delaunay/Delaunay triangulationsDelaunay triangulations/D3/Visualization/d3-delaunay/Delaunay triangulationsVoronoi diagrams/D3/Visualization/d3-delaunay/Voronoi diagramsVoronoi diagrams/D3/Visualization/d3-delaunay/Voronoi diagramsForce simulations/D3/Visualization/d3-force/Force simulationsForce simulations/D3/Visualization/d3-force/Force simulationsCenter force/D3/Visualization/d3-force/Center forceCenter force/D3/Visualization/d3-force/Center forceCollide force/D3/Visualization/d3-force/Collide forceCollide force/D3/Visualization/d3-force/Collide forceLink force/D3/Visualization/d3-force/Link forceLink force/D3/Visualization/d3-force/Link forceMany-body force/D3/Visualization/d3-force/Many-body forceMany-body force/D3/Visualization/d3-force/Many-body forcePosition forces/D3/Visualization/d3-force/Position forcesPosition forces/D3/Visualization/d3-force/Position forcesPaths/D3/Visualization/d3-geo/PathsPaths/D3/Visualization/d3-geo/PathsStreams/D3/Visualization/d3-geo/StreamsStreams/D3/Visualization/d3-geo/StreamsSpherical shapes/D3/Visualization/d3-geo/Spherical shapesSpherical shapes/D3/Visualization/d3-geo/Spherical shapesSpherical math/D3/Visualization/d3-geo/Spherical mathSpherical math/D3/Visualization/d3-geo/Spherical mathHierarchies/D3/Visualization/d3-hierarchy/HierarchiesHierarchies/D3/Visualization/d3-hierarchy/HierarchiesStratify/D3/Visualization/d3-hierarchy/StratifyStratify/D3/Visualization/d3-hierarchy/StratifyTree/D3/Visualization/d3-hierarchy/TreeTree/D3/Visualization/d3-hierarchy/TreeCluster/D3/Visualization/d3-hierarchy/ClusterCluster/D3/Visualization/d3-hierarchy/ClusterPartition/D3/Visualization/d3-hierarchy/PartitionPartition/D3/Visualization/d3-hierarchy/PartitionPack/D3/Visualization/d3-hierarchy/PackPack/D3/Visualization/d3-hierarchy/PackTreemap/D3/Visualization/d3-hierarchy/TreemapTreemap/D3/Visualization/d3-hierarchy/TreemapLinear scales/D3/Visualization/d3-scale/Linear scalesLinear scales/D3/Visualization/d3-scale/Linear scalesTime scales/D3/Visualization/d3-scale/Time scalesTime scales/D3/Visualization/d3-scale/Time scalesPow scales/D3/Visualization/d3-scale/Pow scalesPow scales/D3/Visualization/d3-scale/Pow scalesLog scales/D3/Visualization/d3-scale/Log scalesLog scales/D3/Visualization/d3-scale/Log scalesSymlog scales/D3/Visualization/d3-scale/Symlog scalesSymlog scales/D3/Visualization/d3-scale/Symlog scalesOrdinal scales/D3/Visualization/d3-scale/Ordinal scalesOrdinal scales/D3/Visualization/d3-scale/Ordinal scalesBand scales/D3/Visualization/d3-scale/Band scalesBand scales/D3/Visualization/d3-scale/Band scalesPoint scales/D3/Visualization/d3-scale/Point scalesPoint scales/D3/Visualization/d3-scale/Point scalesSequential scales/D3/Visualization/d3-scale/Sequential scalesSequential scales/D3/Visualization/d3-scale/Sequential scalesDiverging scales/D3/Visualization/d3-scale/Diverging scalesDiverging scales/D3/Visualization/d3-scale/Diverging scalesQuantile scales/D3/Visualization/d3-scale/Quantile scalesQuantile scales/D3/Visualization/d3-scale/Quantile scalesQuantize scales/D3/Visualization/d3-scale/Quantize scalesQuantize scales/D3/Visualization/d3-scale/Quantize scalesThreshold scales/D3/Visualization/d3-scale/Threshold scalesThreshold scales/D3/Visualization/d3-scale/Threshold scalesCategorical schemes/D3/Visualization/d3-scale-chromatic/Categorical schemesCategorical schemes/D3/Visualization/d3-scale-chromatic/Categorical schemesCyclical schemes/D3/Visualization/d3-scale-chromatic/Cyclical schemesCyclical schemes/D3/Visualization/d3-scale-chromatic/Cyclical schemesDiverging schemes/D3/Visualization/d3-scale-chromatic/Diverging schemesDiverging schemes/D3/Visualization/d3-scale-chromatic/Diverging schemesSequential schemes/D3/Visualization/d3-scale-chromatic/Sequential schemesSequential schemes/D3/Visualization/d3-scale-chromatic/Sequential schemesSelecting elements/D3/Visualization/d3-selection/Selecting elementsSelecting elements/D3/Visualization/d3-selection/Selecting elementsModifying elements/D3/Visualization/d3-selection/Modifying elementsModifying elements/D3/Visualization/d3-selection/Modifying elementsJoining data/D3/Visualization/d3-selection/Joining dataJoining data/D3/Visualization/d3-selection/Joining dataHandling events/D3/Visualization/d3-selection/Handling eventsHandling events/D3/Visualization/d3-selection/Handling eventsControl flow/D3/Visualization/d3-selection/Control flowControl flow/D3/Visualization/d3-selection/Control flowLocal variables/D3/Visualization/d3-selection/Local variablesLocal variables/D3/Visualization/d3-selection/Local variablesNamespaces/D3/Visualization/d3-selection/NamespacesNamespaces/D3/Visualization/d3-selection/NamespacesArcs/D3/Visualization/d3-shape/ArcsArcs/D3/Visualization/d3-shape/ArcsAreas/D3/Visualization/d3-shape/AreasAreas/D3/Visualization/d3-shape/AreasCurves/D3/Visualization/d3-shape/CurvesCurves/D3/Visualization/d3-shape/CurvesLines/D3/Visualization/d3-shape/LinesLines/D3/Visualization/d3-shape/LinesLinks/D3/Visualization/d3-shape/LinksLinks/D3/Visualization/d3-shape/LinksPies/D3/Visualization/d3-shape/PiesPies/D3/Visualization/d3-shape/PiesStacks/D3/Visualization/d3-shape/StacksStacks/D3/Visualization/d3-shape/StacksSymbols/D3/Visualization/d3-shape/SymbolsSymbols/D3/Visualization/d3-shape/SymbolsRadial areas/D3/Visualization/d3-shape/Radial areasRadial areas/D3/Visualization/d3-shape/Radial areasRadial lines/D3/Visualization/d3-shape/Radial linesRadial lines/D3/Visualization/d3-shape/Radial linesRadial links/D3/Visualization/d3-shape/Radial linksRadial links/D3/Visualization/d3-shape/Radial linksSelecting elements/D3/Animation/d3-transition/Selecting elementsSelecting elements/D3/Animation/d3-transition/Selecting elementsModifying elements/D3/Animation/d3-transition/Modifying elementsModifying elements/D3/Animation/d3-transition/Modifying elementsTiming/D3/Animation/d3-transition/TimingTiming/D3/Animation/d3-transition/TimingControl flow/D3/Animation/d3-transition/Control flowControl flow/D3/Animation/d3-transition/Control flowAdding numbers/D3/Data/d3-array/Adding numbersAdding numbers/D3/Data/d3-array/Adding numbersBinning data/D3/Data/d3-array/Binning dataBinning data/D3/Data/d3-array/Binning dataBisecting data/D3/Data/d3-array/Bisecting dataBisecting data/D3/Data/d3-array/Bisecting dataBlurring data/D3/Data/d3-array/Blurring dataBlurring data/D3/Data/d3-array/Blurring dataGrouping data/D3/Data/d3-array/Grouping dataGrouping data/D3/Data/d3-array/Grouping dataInterning values/D3/Data/d3-array/Interning valuesInterning values/D3/Data/d3-array/Interning valuesSet operations/D3/Data/d3-array/Set operationsSet operations/D3/Data/d3-array/Set operationsSorting data/D3/Data/d3-array/Sorting dataSorting data/D3/Data/d3-array/Sorting dataSummarizing data/D3/Data/d3-array/Summarizing dataSummarizing data/D3/Data/d3-array/Summarizing dataTicks/D3/Data/d3-array/TicksTicks/D3/Data/d3-array/TicksTransforming data/D3/Data/d3-array/Transforming dataTransforming data/D3/Data/d3-array/Transforming dataAzimuthal projections/D3/Visualization/d3-geo/Projections/Azimuthal projectionsAzimuthal projections/D3/Visualization/d3-geo/Projections/Azimuthal projectionsConic projections/D3/Visualization/d3-geo/Projections/Conic projectionsConic projections/D3/Visualization/d3-geo/Projections/Conic projectionsCylindrical projections/D3/Visualization/d3-geo/Projections/Cylindrical projectionsCylindrical projections/D3/Visualization/d3-geo/Projections/Cylindrical projectionsD3/D3Introduction/D3/IntroductionVisualization/D3/VisualizationAnimation/D3/AnimationInteraction/D3/InteractionData/D3/Datad3-chord/D3/Visualization/d3-chordd3-chord/D3/Visualization/d3-chordd3-interpolate/D3/Visualization/d3-interpolated3-interpolate/D3/Visualization/d3-interpolated3-contour/D3/Visualization/d3-contourd3-contour/D3/Visualization/d3-contourd3-delaunay/D3/Visualization/d3-delaunayd3-delaunay/D3/Visualization/d3-delaunayd3-force/D3/Visualization/d3-forced3-force/D3/Visualization/d3-forced3-geo/D3/Visualization/d3-geod3-geo/D3/Visualization/d3-geod3-hierarchy/D3/Visualization/d3-hierarchyd3-hierarchy/D3/Visualization/d3-hierarchyd3-scale/D3/Visualization/d3-scaled3-scale/D3/Visualization/d3-scaled3-scale-chromatic/D3/Visualization/d3-scale-chromaticd3-scale-chromatic/D3/Visualization/d3-scale-chromaticd3-selection/D3/Visualization/d3-selectiond3-selection/D3/Visualization/d3-selectiond3-shape/D3/Visualization/d3-shaped3-shape/D3/Visualization/d3-shaped3-transition/D3/Animation/d3-transitiond3-transition/D3/Animation/d3-transitiond3-array/D3/Data/d3-arrayd3-array/D3/Data/d3-arrayProjections/D3/Visualization/d3-geo/ProjectionsProjections/D3/Visualization/d3-geo/Projections

TIP

Unless you need D3’s low-level control, we recommend our high-level sister library: Observable Plot. Whereas a histogram in D3 might require 50 lines of code, Plot can do it in one! Plot’s concise yet expressive API lets you focus more on analyzing and visualizing data instead of web development. You can even combine Plot and D3 for the best of both.

D3 is flexible

Because D3 has no overarching “chart” abstraction, even a basic chart may require a few dozen lines of code. On the upside, all the pieces are laid out in front of you and you have complete control over what happens. You can tailor the visualization to achieve exactly what you want. D3 has no default presentation of your data — there’s just the code you write yourself. (Or copy from an example.)

Consider D3 an alternative to “doing everything yourself”, not an alternative to a high-level charting library. If you aren’t satisfied with other tools and you’re thinking of rolling your own charts using SVG or Canvas (or even WebGL), you might as well peruse D3’s toolbox! There’s almost certainly something here that will help you build the chart of your dreams without imposing on your creativity.

D3 works with the web

D3 doesn’t introduce a new graphical representation; instead, you use D3 directly with web standards such as SVG and Canvas.

The name “D3” is short for data-driven documents, where documents refers to the Document Object Model (DOM) standard that represents the contents of a webpage. While some of D3’s modules (such as selections and transitions) touch the DOM, others (including scales and shapes) only operate on data. D3 can also be paired with web frameworks such as React, Vue, and Svelte; see the getting started guide for recommendations.

D3’s embrace of web standards brings many benefits. For example, you can use external stylesheets to alter the appearance of charts (even in response to media queries, say for responsive charts or dark mode); you can use the debugger and element inspector to review what your code is doing; and D3’s synchronous, imperative evaluation model — calling selection.attr immediately mutates the DOM — can make it easier to debug than frameworks with complex asynchronous runtimes.

D3 is for bespoke visualization

D3 makes things possible, not necessarily easy; even simple things that should be easy are often not. To paraphrase Amanda Cox: “Use D3 if you think it’s perfectly normal to write a hundred lines of code for a bar chart.”

If you need maximal expressiveness for your bespoke visualization, you should consider D3. D3 makes sense for media organizations such as The New York Times or The Pudding, where a single graphic may be seen by a million readers, and where a team of editors can work together to advance the state of the art in visual communication.

On the other hand, D3 is overkill for throwing together a private dashboard or a one-off analysis. Don’t get seduced by whizbang examples: many of them took an immense effort to implement! If you’re constrained by time (and who isn’t?), you’d likely produce a better visualization or analysis with Observable Plot.

D3 is for dynamic visualization

D3’s most novel concept is its data join: given a set of data and a set of DOM elements, the data join allows you to apply separate operations for entering, updating, and exiting elements. If you’re only creating static charts (charts that don’t animate or respond to user input), you may find this concept unintuitive or even bizarre because it’s not needed.

The data join exists so that you can control exactly what happens when your data changes and update the display in response. This direct control allows extremely performant updates — you only touch the elements and attributes that need changing, without diffing the DOM — and smooth animated transitions between states. D3 shines for dynamic, interactive visualizations. (Try option-clicking the state toggles in “512 Paths to the White House” from 2012. Really.)