d3.js

how to express a queue of Promise in d3 v5

橙三吉。 提交于 2020-07-23 06:43:06
问题 I have already read these answers, but I wasn't able to solve: Adapt old geo to D3 v5, how to express a queue of Promise? d3.js v5 - Promise.all replaced d3.queue My code in d3 v4 looks like d3.queue() .defer(d3.json, "path/file.json") .defer(populate,map,data) .await(ready); } function populate(map,data,callback) { .. code .. callback(null); } function ready(error, topo) { .. code .. } I would like to replace this with Promise 回答1: I'm assuming your populate function returns topo. You can

how to express a queue of Promise in d3 v5

我与影子孤独终老i 提交于 2020-07-23 06:42:44
问题 I have already read these answers, but I wasn't able to solve: Adapt old geo to D3 v5, how to express a queue of Promise? d3.js v5 - Promise.all replaced d3.queue My code in d3 v4 looks like d3.queue() .defer(d3.json, "path/file.json") .defer(populate,map,data) .await(ready); } function populate(map,data,callback) { .. code .. callback(null); } function ready(error, topo) { .. code .. } I would like to replace this with Promise 回答1: I'm assuming your populate function returns topo. You can

javascript d3 render chart

青春壹個敷衍的年華 提交于 2020-07-23 06:16:22
问题 I am trying to learn some chart rendering techniques for front end web development. There is a d3 tutorial where the javascript function can be edited on the website (great for learning purposes) and I am attempting to use my own data instead. In the tutorial website I am attempting to modify the rawgit //Read the data d3.csv("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered_comma.csv", with my own rawgit dataset: //Read the data d3.csv("https://raw

javascript d3 render chart

时光怂恿深爱的人放手 提交于 2020-07-23 06:15:14
问题 I am trying to learn some chart rendering techniques for front end web development. There is a d3 tutorial where the javascript function can be edited on the website (great for learning purposes) and I am attempting to use my own data instead. In the tutorial website I am attempting to modify the rawgit //Read the data d3.csv("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered_comma.csv", with my own rawgit dataset: //Read the data d3.csv("https://raw

javascript d3 render chart

你。 提交于 2020-07-23 06:14:28
问题 I am trying to learn some chart rendering techniques for front end web development. There is a d3 tutorial where the javascript function can be edited on the website (great for learning purposes) and I am attempting to use my own data instead. In the tutorial website I am attempting to modify the rawgit //Read the data d3.csv("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered_comma.csv", with my own rawgit dataset: //Read the data d3.csv("https://raw

d3 v5 plotting simple line chart and mapping/casting to numbers using promise

☆樱花仙子☆ 提交于 2020-07-22 22:18:32
问题 I have finally decided to saddle up and adopt d3 v5 syntax after years of using v3. After looking at some tutorials and examples, v5 syntax really struck me as sublime. The readability is far improved and it seems easier to integrate multiple data sources. To my dismay, and despite my reverence of it, I couldn't quite build a visual from scratch with the new Promise syntax. Here is my simple graph: (note I'm using hard coded data for the sake of this post, and I have commented out the .csv()

d3 v5 plotting simple line chart and mapping/casting to numbers using promise

女生的网名这么多〃 提交于 2020-07-22 22:15:47
问题 I have finally decided to saddle up and adopt d3 v5 syntax after years of using v3. After looking at some tutorials and examples, v5 syntax really struck me as sublime. The readability is far improved and it seems easier to integrate multiple data sources. To my dismay, and despite my reverence of it, I couldn't quite build a visual from scratch with the new Promise syntax. Here is my simple graph: (note I'm using hard coded data for the sake of this post, and I have commented out the .csv()

D3 Bar Chart + React Hooks - exit().remove() not working

£可爱£侵袭症+ 提交于 2020-07-22 21:36:05
问题 I'm using react and d3, trying to create a simple bar chart that updates the chart when data is refreshed. The chart is updating when the data changes, but it seems to be layering on top of the old chart. I think the issue is with the d3 exit().remove() function. As I understand it d3's exit method should return an array of items to be removed, however when I console log it I see an array of "undefined"s. I'm super grateful for any help! Here is the codesandbox: https://codesandbox.io/s

D3 Bar Chart + React Hooks - exit().remove() not working

余生颓废 提交于 2020-07-22 21:35:44
问题 I'm using react and d3, trying to create a simple bar chart that updates the chart when data is refreshed. The chart is updating when the data changes, but it seems to be layering on top of the old chart. I think the issue is with the d3 exit().remove() function. As I understand it d3's exit method should return an array of items to be removed, however when I console log it I see an array of "undefined"s. I'm super grateful for any help! Here is the codesandbox: https://codesandbox.io/s

How to run a D3 example

倾然丶 夕夏残阳落幕 提交于 2020-07-22 09:28:25
问题 For example https://observablehq.com/@d3/zoomable-treemap If you paste the fragments of script into a <script> tag in a HTML file the (obviously) it doesn't work. How are you supposed to run these things? And what the heck is italic f ? Why are no statements terminated with a semicolon and why are things declared without var ? Surely this cannot possibly work? <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <!-- Load d3.js --> <script src="https://d3js.org/d3.v4.js"></script> </head>