Answer by i alarmed alien for Do d3 elements need to be redefined with...
The simple answer to your question is "no, elements do not need to be redefined with repeated code." The longer answer (which I will try to keep short) concerns the d3 enter / update / exit paradigm...
View ArticleAnswer by i alarmed alien for Issue formatting data in JavaScript for a pie...
As noted in my comment, your problem is because d3.csv acts asynchronously, and input_data isn't populated when d3pie tries to create your chart.There is something highly suspicious going on with...
View ArticleAnswer by i alarmed alien for D3 treemap json implementation with d3.nest
Your code was almost complete; the only things missing were that you needed to add a fake root node to your hierarchy, to specify the accessor for the children, and to fix the value for the leaf nodes,...
View ArticleAnswer by i alarmed alien for Add event listener per nodes level on d3 chart
If you want to collapse all nodes except the root and the first set of children, you can run the following code:root.children.forEach(collapse);This recursively applies the collapse function to all the...
View ArticleAnswer by i alarmed alien for How to group HTML table entries with summary...
You can do this with d3.nest and a bit of data wrangling if you calculate the summary first and integrate it with the nested data. It will also be easier if you make a function for adding td elements...
View ArticleAnswer by i alarmed alien for D3 Chord Diagram Not Rendering Correctly
If you examine the dodgy arc, you will see you can flip it into the right place by altering the sign on the transform from (50,0) to (-50,0). If you then look at the code that assigns the transform, it...
View ArticleAnswer by i alarmed alien for Line chart function pulling out data from...
You don't need the " around the "function(d) { return y(d."+city+"); }" -- that tells javascript to interpret the text function(d) { return y(d. and ); } as a string, giving a y attribute of...
View ArticleAnswer by i alarmed alien for Force directed graphs nodes stick to the center
You have to adapt your code slightly as it currently assumes that you're working with circle elements, where you specify the centres using cx and cy, but you are now using g elements, which use...
View ArticleAnswer by i alarmed alien for d3.js updating from v3 to v5
I removed the top two lines, which were causing a parser error due to the missed ) in d3.csv("E2allProcEff.csv".then and the redundant loading of data by two different...
View ArticleAnswer by i alarmed alien for How to append multiple rectangles in D3?
You're successfully creating extra rectangles, but unfortunately they are all nested inside the first three rectangles. If you have a web developer extension on your browser, select one of the...
View ArticleAnswer by i alarmed alien for d3 - label placement for a nested pie chart
The layout that you have already is dependent on your data being uniform, which doesn't happen in the real world, so I found a data set and used it to create a pie chart that doesn't require perfect...
View ArticleAnswer by i alarmed alien for D3JS wrap text plugin overwritten after...
I've just come across the same issue elsewhere. It is because the text wrap function cannot act on a transition, it requires a selection. To fix your code, just move the text addition and wrap calls to...
View ArticleAnswer by i alarmed alien for d3.json() to load large file
Most visitors will not hang around for the page to load -- I thought that the demo was broken when I first visited the site. A few ideas:JSON is not a compact data format as the tag names get repeated...
View ArticleAnswer by i alarmed alien for dependent filtering with two jquery dropdowns
There are a few ways to solve this problem, but I think the easiest is to store the current values in a variable that both the select element change listeners and any code that needs it (e.g....
View ArticleAnswer by i alarmed alien for How to set the width and height of svg to be...
You can use the values from getClientBoundingRect() to set the width and height of your SVG:var bRect = legend.node().getBoundingClientRect() svg.attr('width', bRect.width + 10) .attr('height',...
View ArticleAnswer by i alarmed alien for D3JS chart: Hovering on some transitioning...
Things are getting messed up because you've added mouseover and mouseout event listeners that try to perform actions that conflict with the ongoing transition events. To fix the problem, don't add the...
View ArticleAnswer by i alarmed alien for Value above each bar stacked bar chart D3.js
You can use your existing y scale to calculate the position of the total in the same way that you've done with the top and bottom edges of the rectangles and the text on each. Rather than using d.y0 or...
View ArticleAnswer by i alarmed alien for Recursive function and this D3.JS
If you want to make your move function recursive, you need to call it from within itself. As always, there are numerous ways to do it, but if you have an array of points, you could either pass in the...
View ArticleAnswer by i alarmed alien for D3 Horizontal grouped stacked chart bars...
Your problem is with the offset of the bars from each other; if you hard-code a value, e.g. using translate(0,29), you are going to be in trouble when the chart data changes, and that makes the bars...
View ArticleReturning results from a custom MediaWiki hook
I'm hacking an existing MediaWiki extension, ProcessCite, that adds a custom hook to the Cite extension. Since migrating to PHP 5.4 and MW 1.22 (from PHP 5.3 and MW 1.19.2), the extension does not...
View Article