Skip to main content

Questions tagged [d3.js]

D3.js is a JavaScript library for creating interactive data-bound visualisations of documents using HTML, SVG, and Canvas. Questions should mention the version number of D3 you are using.

245 votes
12 answers
143k views

What's the best way to make a d3.js visualisation layout responsive?

Assume I have a histogram script that builds a 960 500 svg graphic. How do I make this responsive so on resize the graphic widths and heights are dynamic? <script> var n = 10000, // number of ...
Matt Alcock's user avatar
  • 12.7k
230 votes
8 answers
274k views

How can I remove or replace SVG content?

I have a piece of JavaScript code which creates (using D3.js) an svg element which contains a chart. I want to update the chart based on new data coming from a web service using AJAX, the problem is ...
Sami's user avatar
  • 7,837
228 votes
5 answers
108k views

What is the difference D3 datum vs. data?

Can someone please explain the difference between datum() and data() in D3.js? I see both being used and I am not sure why you should choose one over the other?
josephmisiti's user avatar
  • 9,944
206 votes
7 answers
211k views

Resize svg when window is resized in d3.js

I'm drawing a scatterplot with d3.js. With the help of this question : Get the size of the screen, current web page and browser window I'm using this answer : var w = window, d = document, e ...
mthpvg's user avatar
  • 3,799
166 votes
6 answers
244k views

Show data on mouseover of circle

I have a set of data that I am plotting in a scatter. When I mouseover one of the circles I would like it to popup with data (like x, y values, maybe more). Here is what I tried using: vis....
ScottieB's user avatar
  • 4,002
156 votes
2 answers
96k views

D3.js: what is 'g' in .append("g") D3.js code?

I am new to D3.js, started learning today only I looked the the donut example and found this code var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) ....
daydreamer's user avatar
  • 90.5k
147 votes
11 answers
73k views

Center a map in d3 given a geoJSON object

Currently in d3 if you have a geoJSON object that you are going to draw you have to scale it and translate it in order to get it to the size that one wants and translate it in order to center it. This ...
climboid's user avatar
  • 6,962
143 votes
14 answers
145k views

Python equivalent of D3.js

Can anyone recommend a Python library that can do interactive graph visualization? I specifically want something like d3.js but for python and ideally it would be 3D as well. I have looked at: ...
Eiyrioü von Kauyf's user avatar
140 votes
4 answers
134k views

D3.js: How to get the computed width and height for an arbitrary element?

I need to know exactly the width and height for an arbitrary g element in my SVG because I need to draw a selection marker around it once the user has clicked it. What I've seen in the internet is ...
Andre Pena's user avatar
  • 58.6k
135 votes
6 answers
202k views

How to add a tooltip to an svg graphic?

I have a series of svg rectangles (using D3.js) and I want to display a message on mouseover, the message should be surrounded by a box that acts as background. They should both be perfectly aligned ...
nachocab's user avatar
  • 14.1k
123 votes
2 answers
59k views

What is the difference between svg's x and dx attribute?

What is the difference between svg's x and dx attribute (or y and dy)? When would be a proper time to use the axis shift attribute (dx) versus the location attribute (x)? For example, I have noticed ...
Nathan Reese's user avatar
  • 2,725
115 votes
7 answers
135k views

d3 axis labeling

How do I add text labels to axes in d3? For instance, I have a simple line graph with an x and y axis. On my x-axis, I have ticks from 1 to 10. I want the word "days" to appear underneath it so ...
user1474218's user avatar
  • 1,185
115 votes
5 answers
39k views

Fast and responsive interactive charts/graphs: SVG, Canvas, other?

I am trying to choose the right technology to use for updating a project that basically renders thousands of points in a zoomable, pannable graph. The current implementation, using Protovis, is ...
Andrew Mao's user avatar
  • 36.5k
112 votes
7 answers
38k views

What is the difference between D3 and jQuery?

Referring to this example: http://vallandingham.me/stepper_steps.html it seems that the D3 and jQuery libraries are very similar in the sense that they both do DOM manipulation in an object-chaining ...
zcaudate's user avatar
  • 14.2k
108 votes
3 answers
46k views

Difference between GeoJSON and TopoJSON

What is the difference between GeoJSON and TopoJSON and when would I use one over the other? The description of TopoJSON on GitHub implies the TopoJSON files are 80% smaller. So why not just use ...
Luke's user avatar
  • 1,511

15 30 50 per page
1
2 3 4 5
2625