Skip to content

Instantly share code, notes, and snippets.

Forked from mbostock/.block
Last active May 14, 2018
What would you like to do?

This comment has been minimized.

Copy link

@hirokai hirokai commented Jan 9, 2015

In line 70:

    .attr("width", x(data[0].dx) - 1)

The code above gives negative width for some data I made.

Should x(data[0].dx) - 1 be x(data[0].dx) - x(0) actually?


This comment has been minimized.

Copy link

@wangxuq wangxuq commented Aug 20, 2015

when I use these code to build the chart,the d3.scale.liner().domain([0,1]) cannot work, this is to say the line range cannot appear.why?
as bellow:


This comment has been minimized.

Copy link

@aww aww commented Oct 10, 2015

@hirokai made a very good point about the width computation. This version obviously works, but it doesn't generalize to cases where the x-domain doesn't start at 0. It caused me to waste a little time when I first tried to apply this example to my situation. Width should be instead x(data[0].dx) - x(0) - 1 (assuming we still want gaps between the bins).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment