# JavaScript graph visualization libraries

JavaScript graph visualization libraries draw networks of nodes and the edges that connect them in the browser. A layout step positions each node, often with a force simulation that pulls linked nodes together and pushes other nodes apart. These libraries draw the knowledge graphs, dependency maps, social networks, and fraud-ring views in analysis tools and dashboards.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [D3](#d) | 125.9M | 114.0K | Nov 2026 | ISC |
| [Cytoscape.js](#cytoscape-js) | 100.3M | 11.3K | Nov 2026 | MIT |
| [Apache ECharts](#echarts) | 38.3M | 67.8K | May 2026 | Apache-2.0 |
| [Highcharts](#highcharts) | 13.5M | 240 | Sep 2026 | https://www.highcharts.com/license |
| [force-graph](#force-graph) | 5.6M | 2.2K | Sep 2026 | MIT |
| [vis-network](#vis-network) | 4.2M | 3.6K | Nov 2026 | MIT |
| [Sigma.js](#sigma-js) | 2.8M | 12.2K | Nov 2026 | MIT |
| [3d-force-graph](#threed-force-graph) | 2.6M | 6.6K | Nov 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[D3](#d) has the most monthly downloads in this comparison, at 125.9M, a count that covers all of its chart and graphics uses.

## Capabilities

| Library | Force-directed layout included | Three-dimensional network scene |
| --- | --- | --- |
| [D3](#d) | Yes | No |
| [Cytoscape.js](#cytoscape-js) | Yes | No |
| [Apache ECharts](#echarts) | Yes | No |
| [Highcharts](#highcharts) | Yes | No |
| [force-graph](#force-graph) | Yes | No |
| [vis-network](#vis-network) | Yes | No |
| [Sigma.js](#sigma-js) | No | No |
| [3d-force-graph](#threed-force-graph) | Yes | Yes |

## Libraries

### D3

[GitHub](https://github.com/d3/d3) · [npm](https://www.npmjs.com/package/d3) · [Docs](https://d3js.org/getting-started)

Combines low-level data, layout, and DOM primitives for custom graph visualizations.

- Downloads / mo: 125.9M
- Stars: 114.0K
- Last release: 7.9.2
- License: ISC
- Capabilities: [From the D3 docs](https://d3js.org/getting-started)

**Strengths**

- **Controls graph rendering directly.** Compose SVG or Canvas graphics instead of adopting a fixed graph interface.
- **Computes layouts separately from drawing.** Run force simulations over node objects and draw the positions in application code.

**Watch out for**

- **Graph interfaces require composition.** Build rendering and interaction from primitives rather than a ready-made graph widget.
- **Force simulation mutates input nodes.** Copy node objects when the application must preserve their original values.

```sh
npm install d3
```

**mermaid-js/mermaid** (91.1K stars)

[mermaid-js/mermaid](https://github.com/mermaid-js/mermaid) 

```typescript
export function createLayoutElementGroups(
  element: D3Selection,
  { edgePathsClass = 'edges edgePaths' }: CreateLayoutElementGroupsOptions = {}
): LayoutElementGroups {
  const rootGroups = element.insert('g').attr('class', 'root');
  const clusters = rootGroups.insert('g').attr('class', 'clusters');
  const edgePaths = rootGroups.insert('g').attr('class', edgePathsClass);
  const edgeLabels = rootGroups.insert('g').attr('class', 'edgeLabels');
  const nodes = rootGroups.insert('g').attr('class', 'nodes');

  return { clusters, edgePaths, edgeLabels, nodes, rootGroups };
}

```

[packages/mermaid/src/rendering-util/createGraph.ts](https://github.com/mermaid-js/mermaid/blob/2b1e7f66c2bafcfa2cf5cfe1fdf5db569d7ffddb/packages/mermaid/src/rendering-util/createGraph.ts#L29-L40) · [More projects using D3 →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20d3%20to%20build%20graph%20SVG%20layers%2C%20merge%20graph%20elements%20and%20fit%20network%20camera%20bounds&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript


import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm";

// Declare the chart dimensions and margins.
const width = 640;
const height = 400;
const marginTop = 20;
const marginRight = 20;
const marginBottom = 30;
const marginLeft = 40;

// Declare the x (horizontal position) scale.
const x = d3.scaleUtc()
    .domain([new Date("2023-01-01"), new Date("2024-01-01")])
    .range([marginLeft, width - marginRight]);

// Declare the y (vertical position) scale.
const y = d3.scaleLinear()
    .domain([0, 100])
    .range([height - marginBottom, marginTop]);

// Create the SVG container.
const svg = d3.create("svg")
    .attr("width", width)
    .attr("height", height);

// Add the x-axis.
svg.append("g")
    .attr("transform", `translate(0,${height - marginBottom})`)
    .call(d3.axisBottom(x));

// Add the y-axis.
svg.append("g")
    .attr("transform", `translate(${marginLeft},0)`)
    .call(d3.axisLeft(y));

// Append the SVG element.
container.append(svg.node());

```

From [getting-started.md](https://d3js.org/getting-started)

### Cytoscape.js

[GitHub](https://github.com/cytoscape/cytoscape.js) · [npm](https://www.npmjs.com/package/cytoscape) · [Docs](https://js.cytoscape.org/)

Combines interactive graph visualization, styling, layouts, and graph-analysis operations.

- Downloads / mo: 100.3M
- Stars: 11.3K
- Last release: 3.35.0
- License: MIT
- Capabilities: [From the Cytoscape.js docs](https://js.cytoscape.org/)

**Strengths**

- **Combines analysis with graph interaction.** Run graph-analysis operations alongside an interactive network visualization.
- **Exports the rendered graph.** Save the current view or the entire graph as PNG.

**Watch out for**

- **Image export needs rendered graphs.** Use a rendered instance; headless analysis cannot produce image exports.
- **Labels increase drawing cost.** Show labels selectively to reduce graph rendering work.

```sh
npm install cytoscape
```

**HEmile/juggl** (825 stars)

[HEmile/juggl](https://github.com/HEmile/juggl) 

```typescript
mergeToGraph(elements: ElementDefinition[], batch=true, triggerGraphChanged=true): IMergedToGraph {
      if (batch) {
        this.viz.startBatch();
      }
      const addElements: ElementDefinition[] = [];
      const mergedCollection = this.viz.collection();
      elements.forEach((n) => {
        if (this.viz.$id(n.data.id).length === 0) {
          addElements.push(n);
        } else {
          const gElement = this.viz.$id(n.data.id);
          const extraClasses = CLASSES.filter((clazz) => gElement.hasClass(clazz));

          // @ts-ignore
          extraClasses.push(...gElement.classes().filter((el: string) => el.startsWith('global-') || el.startsWith('local-')));

          // TODO: Maybe make an event here
          gElement.classes(n.classes);
          for (const clazz of extraClasses) {
            gElement.addClass(clazz);
          }
          gElement.data(n.data);
          mergedCollection.merge(gElement);
        }
      });
      const addCollection = this.viz.add(addElements);
      mergedCollection.merge(addCollection);
      if (triggerGraphChanged) {
        this.onGraphChanged(false);
      }
      if (batch) {
        this.viz.endBatch();
      }
      return {merged: mergedCollection, added: addCollection};
    }

```

[src/viz/visualization.ts](https://github.com/HEmile/juggl/blob/4c18c9ed009b8074da704ae3053df607f21e66ed/src/viz/visualization.ts#L511-L545) · [More projects using Cytoscape.js →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20cytoscape%20to%20build%20graph%20SVG%20layers%2C%20merge%20graph%20elements%20and%20fit%20network%20camera%20bounds&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import cytoscape from 'cytoscape';

var cy = cytoscape({
  container: document.getElementById('cy') // container to render in
});

// can use reference to eles later
var eles = cy.add([
  { group: 'nodes', data: { id: 'n0' }, position: { x: 100, y: 100 } },
  { group: 'nodes', data: { id: 'n1' }, position: { x: 200, y: 200 } },
  { group: 'edges', data: { id: 'e0', source: 'n0', target: 'n1' } }
]);

```

From [getting-started.md](https://api.github.com/repos/cytoscape/cytoscape.js/contents/documentation/md/getting-started.md?ref=unstable)

### Apache ECharts

[GitHub](https://github.com/apache/echarts) · [npm](https://www.npmjs.com/package/echarts) · [Docs](https://echarts.apache.org/handbook/en/get-started/)

Draws interactive charts and data visualizations in the browser.

- Downloads / mo: 38.3M
- Stars: 67.8K
- Last release: 6.1.0
- License: Apache-2.0
- Capabilities: [From the Apache ECharts docs](https://echarts.apache.org/handbook/en/get-started/)

**Strengths**

- **Includes a graph series.** Set the graph series layout to force or circular to arrange nodes and links.

```sh
npm install echarts
```

**apache/echarts-examples** (401 stars)

[apache/echarts-examples](https://github.com/apache/echarts-examples) 

```typescript
function (graph) {
  myChart.hideLoading();

  graph.nodes.forEach(function (node: GraphNode) {
    node.label = {
      show: node.symbolSize > 30
    };
  });
  option = {
    title: {
      text: 'Les Miserables',
      subtext: 'Default layout',
      top: 'bottom',
      left: 'right'
    },
    tooltip: {},
    legend: [
      {
        // selectedMode: 'single',
        data: graph.categories.map(function (a: { name: string }) {
          return a.name;
        })
      }
    ],
    animationDuration: 1500,
    animationEasingUpdate: 'quinticInOut',
    series: [
      {
        name: 'Les Miserables',
        type: 'graph',
        legendHoverLink: false,
        layout: 'none',
        data: graph.nodes,
        links: graph.links,
        categories: graph.categories,
        roam: true,
        label: {
          position: 'right',
          formatter: '{b}'
        },
        lineStyle: {
          color: 'source',
          curveness: 0.3
        },
        emphasis: {
          focus: 'adjacency',
          lineStyle: {
            width: 10
          }
        }
      }
    ]
  };

  myChart.setOption(option);
}

```

[public/examples/ts/graph.ts](https://github.com/apache/echarts-examples/blob/88ca004030e999073a15303e5fe32462b8fefae2/public/examples/ts/graph.ts#L16-L71) · [More projects using Apache ECharts →](https://dashboard.exa.ai/playground/search?q=echarts%20GitHub%20projects)

**Quickstart**

```typescript

      // Initialize the echarts instance based on the prepared dom
      var myChart = echarts.init(document.getElementById('main'));

      // Specify the configuration items and data for the chart
      var option = {
        title: {
          text: 'ECharts Getting Started Example'
        },
        tooltip: {},
        legend: {
          data: ['sales']
        },
        xAxis: {
          data: ['Shirts', 'Cardigans', 'Chiffons', 'Pants', 'Heels', 'Socks']
        },
        yAxis: {},
        series: [
          {
            name: 'sales',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20]
          }
        ]
      };

      // Display the chart using the configuration and the data defined above.
      myChart.setOption(option);

```

From [Get started docs](https://echarts.apache.org/handbook/en/get-started/)

### Highcharts

[GitHub](https://github.com/highcharts/highcharts-dist) · [npm](https://www.npmjs.com/package/highcharts) · [Docs](https://www.highcharts.com/docs/chart-and-series-types/network-graph)

Adds force-directed network graphs to Highcharts through the networkgraph module.

- Downloads / mo: 13.5M
- Stars: 240
- Last release: 13.1.1
- License: https://www.highcharts.com/license
- Capabilities: [From the Highcharts docs](https://www.highcharts.com/docs/chart-and-series-types/network-graph)

**Strengths**

- **Takes a list of links.** Pass an array of links, each with a start node and an end node.

**Watch out for**

- **Needs an extra module.** Load the networkgraph module after the main Highcharts script.

```sh
npm install highcharts
```

**Quickstart**

```typescript
    document.addEventListener('DOMContentLoaded', function () {
        const chart = Highcharts.chart('container', {
            chart: {
                type: 'bar'
            },
            title: {
                text: 'Fruit Consumption'
            },
            xAxis: {
                categories: ['Apples', 'Bananas', 'Oranges']
            },
            yAxis: {
                title: {
                    text: 'Fruit eaten'
                }
            },
            series: [{
                name: 'Jane',
                data: [1, 0, 4]
            }, {
                name: 'John',
                data: [5, 7, 3]
            }]
        });
    });

```

From [your-first-chart.md](https://api.github.com/repos/highcharts/highcharts/contents/docs/getting-started/your-first-chart.md) · [Find projects using Highcharts →](https://dashboard.exa.ai/playground/search?q=highcharts%20GitHub%20projects)

### force-graph

[GitHub](https://github.com/vasturiano/force-graph) · [npm](https://www.npmjs.com/package/force-graph) · [Docs](https://raw.githubusercontent.com/vasturiano/force-graph/master/README.md)

Draws a two-dimensional force-directed graph on an HTML5 canvas.

- Downloads / mo: 5.6M
- Stars: 2.2K
- Last release: 1.52.0
- License: MIT
- Capabilities: [From the force-graph docs](https://raw.githubusercontent.com/vasturiano/force-graph/master/README.md)

**Strengths**

- **Built-in pointer interactions.** Zoom, pan, drag nodes, and handle hover and click events on nodes and links.
- **Has React bindings.** Use the react-force-graph package to render the same graph in React.

```sh
npm install force-graph
```

**Quickstart**

```typescript

    // Random tree
    const N = 300;
    const gData = {
      nodes: [...Array(N).keys()].map(i => ({ id: i })),
      links: [...Array(N).keys()]
        .filter(id => id)
        .map(id => ({
          source: id,
          target: Math.round(Math.random() * (id-1))
        }))
    };

    const Graph = new ForceGraph(document.getElementById('graph'))
        .linkDirectionalParticles(2)
        .graphData(gData);

```

From [index.html](https://api.github.com/repos/vasturiano/force-graph/contents/example/basic/index.html) · [Find projects using force-graph →](https://dashboard.exa.ai/playground/search?q=force-graph%20GitHub%20projects)

### vis-network

[GitHub](https://github.com/visjs/vis-network) · [npm](https://www.npmjs.com/package/vis-network) · [Docs](https://visjs.github.io/vis-network/docs/network/)

Displays interactive node-and-edge networks using Canvas, configurable styles and a physics engine.

- Downloads / mo: 4.2M
- Stars: 3.6K
- Last release: 10.1.5
- License: MIT
- Capabilities: [From the vis-network docs](https://visjs.github.io/vis-network/docs/network/)

**Strengths**

- **Includes physics-based node positioning.** Use the physics simulation to arrange nodes and edges.
- **Clusters larger network views.** Group nodes into clusters to reduce the visible network.

**Watch out for**

- **Hierarchical layout overrides other settings.** Expect its own physics solver and static smooth edges in hierarchical mode.
- **Random layouts vary between runs.** Set randomSeed when the initial layout must be repeatable.

```sh
npm install vis-network
```

**Quickstart**

```typescript

    // create an array with nodes
    var nodes = new vis.DataSet([
        {id: 1, label: 'Node 1'},
        {id: 2, label: 'Node 2'},
        {id: 3, label: 'Node 3'},
        {id: 4, label: 'Node 4'},
        {id: 5, label: 'Node 5'}
    ]);

    // create an array with edges
    var edges = new vis.DataSet([
        {from: 1, to: 3},
        {from: 1, to: 2},
        {from: 2, to: 4},
        {from: 2, to: 5}
    ]);

    // create a network
    var container = document.getElementById('mynetwork');

    // provide the data in the vis format
    var data = {
        nodes: nodes,
        edges: edges
    };
    var options = {};

    // initialize your network!
    var network = new vis.Network(container, data, options);

```

From [README.md](https://visjs.github.io/vis-network/docs/network/) · [Find projects using vis-network →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20vis-network%20to%20build%20graph%20SVG%20layers%2C%20merge%20graph%20elements%20and%20fit%20network%20camera%20bounds&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### Sigma.js

[GitHub](https://github.com/jacomyal/sigma.js) · [npm](https://www.npmjs.com/package/sigma) · [Docs](https://www.sigmajs.org/docs/get-started/quickstart/)

Renders Graphology graph data through WebGL with customizable visual styles and interactive camera controls.

- Downloads / mo: 2.8M
- Stars: 12.2K
- Last release: 4.0.6
- License: MIT
- Capabilities: [From the Sigma.js docs](https://www.sigmajs.org/docs/get-started/quickstart/)

**Strengths**

- **Styles graphs through data attributes.** Map graph attributes and state into node appearance rules.
- **Supports mouse and touch gestures.** Pan, zoom, and interact with the graph through built-in gestures.

**Watch out for**

- **Missing positions need external layouts.** Compute node positions before rendering a graph that lacks coordinates.
- **Image export needs another package.** Install the separate export-image companion package for image downloads.

```sh
npm install sigma graphology
```

**gephi/gephi-lite** (358 stars)

[gephi/gephi-lite](https://github.com/gephi/gephi-lite) 

```typescript
function fitCameraToMercatorExtent(sigma: Sigma, extent: { minX: number; minY: number; maxX: number; maxY: number }) {
  sigma.setCustomBBox(MERCATOR_WORLD);
  sigma.getCamera().setState({ angle: 0, x: 0.5, y: 0.5, ratio: 1 });

  if (extent.minX > extent.maxX || extent.minY > extent.maxY) return;

  const centerX = (extent.minX + extent.maxX) / 2;
  const centerY = (extent.minY + extent.maxY) / 2;
  const extentW = extent.maxX - extent.minX;
  const extentH = extent.maxY - extent.minY;

  // Visible range at ratio=1 with a 1×1 bbox: sigma fits the square to the
  // viewport preserving aspect ratio, so the longer axis spans W/H or H/W.
  const { width, height } = sigma.getDimensions();
  const visibleW = width >= height ? width / height : 1;
  const visibleH = width >= height ? 1 : height / width;

  const ratio = Math.max(extentW / visibleW, extentH / visibleH, 0.01);
  sigma.getCamera().setState({ angle: 0, x: centerX, y: centerY, ratio });
}

```

[packages/gephi-lite/src/core/sigma/index.ts](https://github.com/gephi/gephi-lite/blob/9570b9cb8bb0fcd9b0912bc68601a13cbaad07ca/packages/gephi-lite/src/core/sigma/index.ts#L123-L142) · [More projects using Sigma.js →](https://dashboard.exa.ai/playground/search?q=JavaScript%20projects%20using%20sigma%20to%20build%20graph%20SVG%20layers%2C%20merge%20graph%20elements%20and%20fit%20network%20camera%20bounds&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import Graph from "graphology";
import Sigma from "sigma";

// Create a graph with graphology
const graph = new Graph();

// Add nodes with positions, sizes, colors, and labels
graph.addNode("1", {
  label: "Node 1",
  x: 0,
  y: 0,
  size: 1,
  color: "blue",
});
graph.addNode("2", {
  label: "Node 2",
  x: 5,
  y: 10,
  size: 1,
  color: "red",
});
graph.addNode("3", {
  label: "Node 3",
  x: 10,
  y: 0,
  size: 1,
  color: "green",
});

// Add edges between nodes
graph.addEdge("1", "2", { size: 1 });
graph.addEdge("2", "3", { size: 1 });
graph.addEdge("3", "1", { size: 1 });

// Render the graph in the container
const renderer = new Sigma(graph, document.getElementById("container"));

```

From [quickstart.mdx](https://api.github.com/repos/jacomyal/sigma.js/contents/packages/website/src/content/docs/get-started/quickstart.mdx?ref=main)

### 3d-force-graph

[GitHub](https://github.com/vasturiano/3d-force-graph) · [npm](https://www.npmjs.com/package/3d-force-graph) · [Docs](https://raw.githubusercontent.com/vasturiano/3d-force-graph/master/README.md)

Draws a three-dimensional force-directed graph with ThreeJS and the d3-force-3d layout engine.

- Downloads / mo: 2.6M
- Stars: 6.6K
- Last release: 1.80.2
- License: MIT
- Capabilities: [From the 3d-force-graph docs](https://raw.githubusercontent.com/vasturiano/3d-force-graph/master/README.md)

**Strengths**

- **Renders with WebGL.** ThreeJS draws the graph scene in WebGL.
- **Offers two physics engines.** Choose d3-force-3d or ngraph to compute the layout.

```sh
npm install 3d-force-graph
```

**Quickstart**

```typescript

    // Random tree
    const N = 300;
    const gData = {
      nodes: [...Array(N).keys()].map(i => ({ id: i })),
      links: [...Array(N).keys()]
        .filter(id => id)
        .map(id => ({
          source: id,
          target: Math.round(Math.random() * (id-1))
        }))
    };

    const Graph = new ForceGraph3D(document.getElementById('3d-graph'))
        .graphData(gData);

```

From [index.html](https://api.github.com/repos/vasturiano/3d-force-graph/contents/example/basic/index.html) · [Find projects using 3d-force-graph →](https://dashboard.exa.ai/playground/search?q=3d-force-graph%20GitHub%20projects)

## FAQ

### Which JavaScript graph visualization library should I use?

[Cytoscape.js](#cytoscape-js) fits interactive graphs that also need graph-analysis operations. [Sigma.js](#sigma-js) draws large graphs with WebGL, [vis-network](#vis-network) arranges nodes with a built-in physics engine, and [D3](#d) fits fully custom graphics.

### What is Cytoscape.js?

[Cytoscape.js](#cytoscape-js) is a graph theory library for analysis and visualization. It runs graph-analysis operations on the same graph that it renders, styles, and lays out.

### What is a force-directed graph?

A force-directed graph positions nodes by simulating forces, where links pull connected nodes together and other nodes push apart. [force-graph](#force-graph), [vis-network](#vis-network), and [D3](#d) include force layouts.

### What is Sigma.js?

[Sigma.js](#sigma-js) renders graphs of thousands of nodes and edges with WebGL. It reads graph data from Graphology, a separate package, and needs an external layout when nodes lack positions.

### Is there a React force graph component?

The author of [force-graph](#force-graph) publishes React bindings as react-force-graph. The canvas version draws two-dimensional graphs, and [3d-force-graph](#threed-force-graph) draws them in three dimensions with ThreeJS.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript graph visualization libraries D3 Cytoscape Sigma vis-network code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
