MCPcopy Index your code
hub / github.com/d3plus/d3plus

github.com/d3plus/d3plus @v3.1.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.6 ↗ · + Follow
1,117 symbols 3,050 edges 469 files 438 documented · 39%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

D3plus

NPM version License codecov

Data visualization made easy. An open-source TypeScript library that extends D3 to create beautiful, interactive SVG visualizations with minimal configuration. Tooltips, color assignments, label placements, and more — all handled automatically.

Full documentation and live examples: d3plus.org

Quick Start

React

npm install @d3plus/react
import {Treemap} from "@d3plus/react";

const config = {
  data: [
    {id: "alpha", value: 29},
    {id: "beta", value: 10},
  ],
  groupBy: "id",
  size: "value",
};

<Treemap config={config} />;

A global set of styles can be applied using the D3plusContext Provider. Per-component config props override globals on a key-by-key basis via deep merge.

import React from "react";
import ReactDOM from "react-dom/client";
import {D3plusContext} from "@d3plus/react";
import App from "src/App.jsx";

const globalConfig = {
  title: "Shared Title for All Visualizations",
};

ReactDOM.createRoot(document.getElementById("viz")).render(
  <React.StrictMode>
    <D3plusContext.Provider value={globalConfig}>
      <App />
    </D3plusContext.Provider>
  </React.StrictMode>,
);

Vanilla JavaScript (CDN)

<script src="https://cdn.jsdelivr.net/npm/@d3plus/core"></script>
<script>
  new d3plus.Treemap()
    .config({
      data: [
        {id: "alpha", value: 29},
        {id: "beta", value: 10},
      ],
      groupBy: "id",
      size: "value",
    })
    .render();
</script>

Packages

D3plus is a modular monorepo — install only what you need:

Package Description
@d3plus/react React component wrappers for all chart types
@d3plus/core Charts, components, and shapes (the main engine)
@d3plus/color Color scales, defaults, and utilities
@d3plus/data Data loading, filtering, and manipulation
@d3plus/dom DOM and browser utility functions
@d3plus/export SVG and image export
@d3plus/format Number and date formatting
@d3plus/locales Translation dictionaries for i18n
@d3plus/math Math and geometry utilities
@d3plus/text Text measurement, wrapping, and fitting
@d3plus/types Unified TypeScript type definitions

For example, to use just the number formatting:

import {formatAbbreviate} from "@d3plus/format";

To get all d3plus types in one import (useful for typing config objects or function parameters):

import type {Treemap, D3plusComponentProps} from "@d3plus/types";

Accessibility

D3plus is built with accessibility in mind. Every visualization automatically includes ARIA attributes, semantic roles, and contextual screen reader labels tailored to each chart type. Features include optional SVG <title> and <desc> elements, inline data tables for assistive technology, color contrast utilities, and localized accessible text. See the Accessibility documentation for a full WCAG 2.1 AA conformance summary.

Built with D3plus

OEC.world | Data USA | DataSaudi | Data Africa | Puerto Rico Family Data Center | COTEC Spain | CDC AR&PSP | Healthy Communities NC | CNY Vitals Pro | DataMPE Brasil | Estonia Statistics

Contributing

See CONTRIBUTING.md for setup instructions, development workflow, and guidelines for submitting pull requests.

License

MIT

Extension points exported contracts — how you extend this code

VizContext (Interface)
(no doc) [7 implementers]
packages/core/src/utils/configPrep.ts
VizContext (Interface)
(no doc) [7 implementers]
packages/data/src/addToQueue.ts
D3plusInstance (Interface)
Minimal interface for d3plus class instances used by the Renderer. [2 implementers]
packages/react/src/Renderer.tsx
TextWrapGenerator (Interface)
(no doc) [1 implementers]
packages/text/src/textWrap.ts
ParsedSides (Interface)
(no doc)
packages/dom/src/parseSides.ts
LocaleEntry (Interface)
(no doc)
packages/locales/src/findLocale.ts
ColorDefaults (Interface)
(no doc)
packages/color/src/defaults.ts
LargestRectEvent (Interface)
(no doc)
packages/math/src/largestRect.ts

Core symbols most depended-on inside this repo

attr
called by 253
packages/dom/src/D3Selection.ts
assign
called by 141
packages/dom/src/assign.ts
filter
called by 135
packages/core/src/charts/Viz.ts
config
called by 126
packages/data/src/load.ts
render
called by 124
packages/react/src/Renderer.tsx
accessor
called by 99
packages/react/test/Renderer-test.mjs
style
called by 98
packages/dom/src/D3Selection.ts
domain
called by 95
packages/core/src/components/Axis.ts

Shape

Method 693
Function 279
Class 102
Interface 43

Languages

TypeScript100%

Modules by API surface

packages/core/src/charts/Viz.ts104 symbols
packages/core/src/charts/Plot.ts66 symbols
packages/core/src/components/Axis.ts63 symbols
packages/core/src/shapes/Shape.ts59 symbols
packages/react/index.tsx43 symbols
packages/core/src/components/TextBox.ts42 symbols
packages/core/src/components/Tooltip.ts39 symbols
packages/core/src/components/ColorScale.ts34 symbols
packages/react/test/Renderer-test.mjs29 symbols
packages/core/src/components/Timeline.ts27 symbols
packages/core/src/components/Legend.ts25 symbols
packages/core/src/charts/Geomap.ts25 symbols

For agents

$ claude mcp add d3plus \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact