circle-pack

D3 - How to convert circle-pack to ellipse-pack?

南笙酒味 提交于 2019-12-10 10:55:11
问题 How to utilize D3 circle pack layout to get diagram similar to this: (even with more elongated ellipses)? The key aplication of this diagram style would be easier label placement. This is jsfiddle that demonstrates circle pack, that I made for other purposes, but I guess it might be useful starting point for anyone wanting to experiment and test potential solution involving ellipses. Based on @Mariatta 's answer, I got this jsfiddle: But I was hoping I would preserve parent-children visual

How to show d3.js circle pack graph in a Rails application?

﹥>﹥吖頭↗ 提交于 2019-12-09 13:58:04
问题 I have been trying for long to make this : http://bl.ocks.org/mbostock/4063269#flare.json example work in my sample Rails app to learn about d3.js. But, I am getting hard time to make it work. I put the following code in my index.html.erb file : <script type="text/javascript"> var diameter = 960, format = d3.format(",d"), color = d3.scale.category20c(); var bubble = d3.layout.pack() .sort(null) .size([diameter, diameter]) .padding(1.5); var svg = d3.select("body").append("svg") .attr("width",

Updating the data of a pack layout from JSON call and redrawing

旧街凉风 提交于 2019-12-09 03:13:54
问题 I've been toying around with the circle pack sample. However, I have a lot of trouble trying to update the thing from a new set of JSON data and refreshing it afterwards. My code is just a modified version of the circle pack sample: var diameter = 960, format = d3.format(",d"); var pack = d3.layout.pack() .size([diameter - 4, diameter - 4]) .value(function(d) { return d.size; }); var svg = d3.select("body").append("svg") .attr("width", diameter) .attr("height", diameter) .append("g") .attr(

How to display d3 bubbles in different colors for a dataset with one branch and many children?

妖精的绣舞 提交于 2019-12-08 01:54:40
问题 Developing a d3 bubble chart by following the example posted at http://bl.ocks.org/mbostock/4063269: My dataset is has one branch but many children (see sample below). All my bubbles are displayed in the same color. Is it possible to modify the logic to generate different color bubbles for each children in the same branch? If so, any assistance would be much appreciated. { "name": "mydata", "children": [ {"name": "test1", "size": 5}, {"name": "test2", "size": 10}, {"name": "test3", "size": 15

'd3-circle-text' on zoomable circle-pack

扶醉桌前 提交于 2019-12-07 16:48:51
问题 The 'd3-circle-text' plug-in works great on a static circle-pack (many thanks to musically-ut for contributing https://github.com/musically-ut/d3-circle-text). However, on a zoomable circle-pack, labels fly about the place (in the fiddle, they stay static not repositioning on zoom). Is it possible to get the circle-text to zoom with the circles? (If the plug-in isn't zoomable, that's ok. I'll try another labelling approach.) Here's the code section I'm working on: ////////////Circle text var

Updating D3 circle pack layout

爱⌒轻易说出口 提交于 2019-12-07 11:12:36
问题 I'm trying to dynamically update a d3 circle pack layout with data I receive in json. Every second I call d3.json() to get the new json. Instead of updating the existing visualization, my implementation just creates a new one under the old one. I want to to dynamically update the existing layout instead... <!DOCTYPE html> <html> <head> <script type="text/javascript" src="d3.v2.js"> </script> <script type="text/javascript" src="jquery-1.4.min.js"></script> <link rel="stylesheet" href="style

D3 update circle-pack data new nodes overlap existing nodes

99封情书 提交于 2019-12-07 10:48:48
问题 I'm following the General Update Pattern but having an issue with regards to layering. Using a circle-pack layout, I pack the new data, update , enter and exit the circle elements. However, when new elements enter , they overlap the updated circles. Data key function is based on element name: .data(nodes, function(d, i) { return d.name; }); So my circle pack has a spot for the updated circle (of the correct location and size) but it's hidden behind its newly entered parent circle. Is there a

D3 - How to convert circle-pack to ellipse-pack?

自闭症网瘾萝莉.ら 提交于 2019-12-06 11:15:25
How to utilize D3 circle pack layout to get diagram similar to this: (even with more elongated ellipses)? The key aplication of this diagram style would be easier label placement. This is jsfiddle that demonstrates circle pack, that I made for other purposes, but I guess it might be useful starting point for anyone wanting to experiment and test potential solution involving ellipses. Based on @Mariatta 's answer, I got this jsfiddle : But I was hoping I would preserve parent-children visual connection. In the second attempt, I got what I want ( jsfiddle ): The key was to change cy of the

How to display d3 bubbles in different colors for a dataset with one branch and many children?

China☆狼群 提交于 2019-12-06 10:51:29
Developing a d3 bubble chart by following the example posted at http://bl.ocks.org/mbostock/4063269 : My dataset is has one branch but many children (see sample below). All my bubbles are displayed in the same color. Is it possible to modify the logic to generate different color bubbles for each children in the same branch? If so, any assistance would be much appreciated. { "name": "mydata", "children": [ {"name": "test1", "size": 5}, {"name": "test2", "size": 10}, {"name": "test3", "size": 15}, {"name": "test4", "size": 20} ] } Simply pass a different datum to the color function, e.g. the

How to achieve that bubbles are only clickable if completly zoomed d3js

岁酱吖の 提交于 2019-12-06 06:26:07
问题 I have a little problem here: I'm working with this example (http://bl.ocks.org/mbostock/7607535) and I modified the flare.json file like this: { "name": "flare", "children": [ { "name": "Kommunikation und Umwelt", "children": [ { "name": "Courses", "children": [ { "name": "AO-Psy.", "children": [ {"name": "Prof. A", "size": 5731,"url":"index.html"}, {"name": "Prof. B", "size": 5731}, {"name": "Prof. C", "size": 5731} ] }, { "name": "E&E", "children": [ {"name": "Prof. D", "size": 5731}, {