Skip to content
Advertisement

Tag: d3.js

d3 line generator returning null rather than path data string

I’m using d3 v4 to create a line graph. My pathGenerator, using d3’s line() method, is returning null instead of a path data string (eg “M 100 100 L 300 100 L 200 300 z”), and therefore no lines are being drawn. When I add in console.log()s to try to determine where the issue occurs, the passed in datum appears

Create a scale for bands with different width in D3.js

We have projects, which are assigned to different teams. Now I have to create project timelines. For the purposes of this question I have created a dummy in jsfiddle.net. https://jsfiddle.net/cezar77/6u1waqso/2 The “dummy” data look like this: The time is displayed on the x axis and there is a horizontal bar for every project stretching from the start_date to the end_date.

d3 run animations inside function in order

I am trying to run animations in order. Here is an example. So i want to create a function like this so i can run them in the order rect1(), rect2(), highlightRect() one after another (after each animation ends). I have tried something like this but it gets messy when there are more animations. Might be an ignorant question can

How to load data from a CSV file in D3 v5

I’m trying to load data from a CSV file in D3; I have this code: If I use D3 v4 it works fine, but if I switch to v5 it doesn’t work anymore. Can someone explain to me how to modify the code to make it work with D3 v5? Answer d3 v5 uses the fetch API and returns a

make d3 force static layout more quickly

I am new in d3js. I rendered a graph ~10000 nodes. I used web worker and static force render ( because normal render is costing more than twice than the web worker). When the range was 10000, it will cost almost 20 seconds, you can see it at console, so how to reduce this times? jsfiddle Answer You are looking

Get red color of schemeCategory10

I’m tying to get the red color (or any color) of the schemeCategory10. I tried this: But I always get the same color (orange) when I change the number into the function colors. How can I get red instead of orange ? How does it work? Answer In an ordinal scale, if you don’t set the domain explicitly, the domain

Advertisement