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.
d3.js
39,361
questions
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 ...
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 ...
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?
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 ...
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....
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)
....
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...