Pie (donut) chart tooltips - d3.js

I want to use exactly this d3 donut chart.
This 3d chart
However, instead of showing percentage, I'd like to show the raw datas that I am providing.
Ideally, the percentage could be shown (as it is now) and I could show the raw datas for each donut part using an onmouseover tooltip!
Can't make it work.
Thanks a lot for any help!

Are you looking for this,I update the fiddle with tool tip,
Initially add a div to the body i.e.
var div = d3.select("body").append("div").attr("class", "tooltip");
then whenever user makes a mouseover or mousemove on the paths/arcs do the necessary.
have a look in http://jsfiddle.net/Q3dhh/25/

Related

How to make a tooltip for a chart in d3?

We need to make it move like here.example The code is complex there, I can't figure it out.
I wrote the code my code, but I don’t understand how to make the tooltip move horizontally not behind the mouse, but near the nearest horizontal mark (as in the example)
It is not yet clear where the text above the bold text in the tooltip comes from. How to remove it so that it looks like in the picture?
How do I make the title of the tooltip match the label on the X-axis?
There are many ways to accomplish this. The way I typically do this is to create a series of SVG elements -- such as circles or rects -- using the same scale and data as the paths.
You can make these objects visible or invisible. Either way, you can attach mouseenter, mouseleave events to each to render and populate the tooltip.

Amcharts legend dynamic resizing

I want my legend to adjust itslef according to the amount of data that is coming in like highcharts . For example if I have only one legend I don't wanna legend to take the length as the div itself and I also have multiple pods .if there are a lot of legends I want it to have scrollbar instead now it's reducing the size of the chart itself.
Pls give your valuable inputs .
You can have the Legend rendered inside a defined Element referring to it using divId.
Then just make sure your legend element is setup to use scrollbars.
Please check the example here: https://codepen.io/team/amcharts/pen/dac1c66de18a50661c8195d4b792a30c

How do I gray out D3 elements based on form input?

I am working on a dynamic scatter plot using D3. (Current draft)
I would like to include a form at the bottom of the page that hides or grays out some of the circles depending on the form.
The form will have checkboxes and sliders. This question only asks about sliders. At the moment I'm stuck at how to make D3 elements respond to a form
Following this tutorial I made a slider that calls an update function when the user interacts with the slider. This SO answer gives the code for changing the color fill of a data point.
The console.log statement inside the update function suggests that I am not selecting the proper D3 element.
How do I access/link the proper D3 elements?
You should filter your data according to form inputs, and then notify d3.js with changed data. Put something like
d3.select('#chart svg')
.datum(filterDataset(dataset, nRadius))
.transition().duration(1000)
.call(chart);
in your update function (example in pastebin)
Graying out is much the same, except you only change attributes in your data and making d3 colorize items according your attributes.

Prerender dc.js on server, maintain interactive events on client

Title says it all: I prerender a chart on a server using dc.js and node.js and return the SVG back to the client. The SVG looks like the following: https://gist.github.com/anonymous/e2f7d237bcc784cfe97d
At the client, I simply write the returned SVG into a div
var svg = prerenderChart(...)
document.getElementById("dc_plot").innerHTML = svg;
The result looks pretty okay, the only problem is that the "track lines" are not appearing when I hover a data point. It should look like the following: http://s2.postimg.org/jqs37yird/3837933.png
I can see in the SVG, that the blue dot and the dotted grey lines are there, but they will not be set visible on a mouseover. I suppose it has something to do with dc.js's mouseover event listener which is not bound to the SVG in dc_plot (dc.js, d3.js and crossfilter.js are added at the client side). Of course I could write my own event listener but maybe there's an easier solution?

Invert nvd3.js legend click function

So, in nvd3 charts, clicking on a legend entry basically filters that out of the chart window (for instance in the case of area charts). I want to invert this functionality..i.e. show the particular chart when its corresponding legend is shown and hide all the others...is there a way to do it?
It is similar to what happens when user hits the chart itself (i.e. only the one that is clicked is expanded and rest of the streams hide).
I am referring to this example: http://nvd3.org/ghpages/stackedArea.html
There's a radioButtonMode that should do exactly what you want. You should be able to set this on the chart, i.e.
chart.radioButtonMode(true);

Resources