d3.js

How to move along a path but only between two specified path points

房东的猫 提交于 2020-01-17 06:45:35
问题 This question is about d3 version 3.x and path movements. Imagine there is a path and a circle element, and I want the circle to follow that path in a transition, but only up to some percentage. I was asking this before and got a great answer from Gerardo Furtado here: My former question Still, one question in this regards remains for me, and as I am a beginner, I couldn't find any working solution so far: How can i trace this path, lets say, from a point at 25% to a point at 50%, and then

Large geojson to topojson

百般思念 提交于 2020-01-17 06:41:52
问题 I am trying to convert a relatively large geojson file (383 MB) to topojson to use it with D3.js. I am running the following command on a mac book pro 2016: geo2topo test.json > test.topojson and also the following command for simplification: geo2topo test.json > test.topojson -q 10000 Both of them produce the same following error: buffer.js:503 throw new Error('"toString()" failed'); ^ Error: "toString()" failed at Buffer.toString (buffer.js:503:11) at JSON.parse () at ReadStream. (/usr

Calling function expression from external Javascript file within Angular4 component

左心房为你撑大大i 提交于 2020-01-17 05:22:26
问题 I'm having hard times trying to call a function expression from an external Javascript file (called roadmap.js) within the web application I'm developping using Angular4 and angular-cli. Roadmap.js is based on d3.js and available on a public Github repo. For now, I have: Installed d3 and @types/d3 via npm Put roadmap.js file in my asset folder, after tweaking it to isolate a parse function Imported d3 in roadmap.component.ts Declared parse , the function I'd like to call in my component, as

D3 Horizontal stacked bar chart axis cut off

帅比萌擦擦* 提交于 2020-01-17 05:19:14
问题 Hope someone can help, I have a slight problem in that the horizontal axis label 100 gets cut off the end of the stacked horizontal barchart. I can't seem to figure out what is wrong in the code. Thanks in advance for your help. Please see code below. <!DOCTYPE html> --> <html> <head> <title>Horizontal stacked bar</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="d3/d3.js"> </script> <style> .axis{ font-size: 14px; } #h{ } <

d3: svg image in zoom circle packing

孤人 提交于 2020-01-17 05:09:26
问题 UPDATE: New JSFIDDLE Scaling now working, ditched the defs and rect altogether and just appended the image. But still stuck on translate. The translating is still not working on zoom. I can set the translate to say -100 for both x and y to get the non-zoomed placement correct. But, when zooming, it's of course still translating it -100 and not the larger value it would need to be to keep it in place. Appears to need something in the code in the zoom section toward the bottom. Been messing

d3js zooming groups of circles

喜夏-厌秋 提交于 2020-01-17 04:57:25
问题 I am trying d3.js zoom behavior for the first time, I am quite struggling to get it worked. My requirement is to have a zoom in, zoom out behaviour in a svg element where browser's zoom behaviour should be disabled and only the circles inside the svg should increase/decrease its radius upon zoom in/out. In summary, when the user scrolls the mouse the svg width, height should not change. Just the circles should change its radius. This is what I have now, can anyone help me to fill it in? <g>

Howto set custom ticks and labels on Y axis in nvd3

泪湿孤枕 提交于 2020-01-17 04:25:47
问题 I'd like to set custom tick number and labels for my discrete chart done in nvd3. The problem is that labels and values needs to be shown in ratios like 10:1, 8:1 etc. but actual bar height shown as numbers 10, 8 etc. Is there any way to create custom labels on y axis and on mouse over tool-tips in nvd3? 回答1: You can do this using tickFormat (which is actually a raw D3 method): chart.yAxis .tickFormat(function (d) { return d + ':' + 1; }); NVD3 will automatically use that format in the

need to set back ground color for c3 sub chart or make it less transparent than main chart

人走茶凉 提交于 2020-01-17 03:44:12
问题 When I am using sub chart, one problem I am facing with user experience is both Main chart and Sub chart are of same importance, I mean same color, etc Instead what I expect is the sub chart should be less transparent or should be provided an option to set back ground color for sub chart. Is it possible? I don't see any option to set back ground color for the sub chart on documentation page. Any guidance please ... 回答1: You'd need to style it manually. I don't see that C3 uses any particular

Update Selection in D3 is empty

走远了吗. 提交于 2020-01-17 03:21:06
问题 In my code, my update selection is always empty, as is my exit selection, so the transitions never run. Every time I refresh, I end up redrawing the entire DOM fragment as if it never existed before (i.e. I can remove everything but .enter and the behavior doesn't change). I'm making use of a key function in data() to ensure the join is being made on a unique value instead of by position. The entire code is at http://jsfiddle.net/colin_young/xRQjX/23/, but I've extracted what I think is the

D3js outer limits

谁说胖子不能爱 提交于 2020-01-17 03:06:08
问题 I would like to use the zoom listener (scale) in combination with translate to fit all nodes, texts and paths nicely into the viewport/d3 container. I'm using the tree layout in combination with the force layout. Is there a way to get the outer limits of all objects (sort of non existing rectangle around the objects with height/width and X+y position of the rectangle)? This would then allow me to use translate/scale to fit everything nicely. 回答1: I tried a few ways when trying to solve this.