Defect on two of Mike Bostocks examples

40 views
Skip to first unread message

timothylegg

unread,
Feb 14, 2018, 1:03:06 AM2/14/18
to d3-js
I sent him an email back in November and it was apparently ignored.  At the time, I didn't really care much either so I let it go at that.  I came across it a second time and am deciding to make this a more public issue.


and


The user cuts-n-pastes these from the website to a term window and they are in for a heartbreaking disappointment.  It appears the graph has a diagonal line through it where the colors are inverted.

It took me two days to discover the cause.  The problem was with the CSV file.  When the user cuts-pastes from the website, they will end up catching two carriage returns at the bottom of the text segment that end up in the file.  If there are two or more carriage returns at the bottom of the CSV file, the graph will be corrupted.  I have not found a way to guarantee that a copy of the data will not catch two newlines.  The only advice is to either adjust the code or instruct the user to mind that there aren't extra newlines at the end of the file.


upload.png

Joe Martinez

unread,
Feb 14, 2018, 8:48:09 AM2/14/18
to d3...@googlegroups.com
I think you picked up the extra line breaks when you copy/pasted.

Remember, you can always download those data files directly - in the first case the url is https://bl.ocks.org/mbostock/raw/431a331294d2b5ddd33f947cf4c81319/sp500.csv

A lot of folks are creating examples on Observable, which makes this even easier.

Cheers,
Joe

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Curran

unread,
Feb 14, 2018, 10:38:31 AM2/14/18
to d3-js
When you want to get code out of bl.ocks.org, usually the best way is to clone the underlying Gist, which keeps all the files intact.

For example:


I don't think there is any defect with the example, only in the method of extracting the code and data.

Best regards,
Curran

Paul Hobson

unread,
Feb 14, 2018, 11:26:26 AM2/14/18
to d3...@googlegroups.com
On Tue, Feb 13, 2018 at 10:03 PM, timothylegg <timoth...@gmail.com> wrote:
I sent him an email back in November and it was apparently ignored.  At the time, I didn't really care much either so I let it go at that.  I came across it a second time and am deciding to make this a more public issue.

I think you're mischaracterizing role of Mike, bl.ocks.org, and anyone else who posts a gist on github. Gists (and by extension, blocks) are quick examples written for their contemporary versions the libraries in use. People post them maybe in hopes that they'll help others or perhaps just as a scratch pad to not lose a thought. But you have to understand that they might go stale. Even so, they'll likely provide a good starting point for a reader to accomplish a similar task.

Mike is a human being with responsibilities outside of the free software and documentation he provides to the world. It's completely imaginable that 1) he gets far more email than he has time to respond to, and 2) he's under no obligation to keep track of every D3 leaf that gets scattered by the wind.
Reply all
Reply to author
Forward
0 new messages