# 直方图布局

Howard Liang edited this page Apr 1, 2016 · 2 revisions

WikiAPI--中文手册布局直方图布局

**直方图布局(histogram layout)**可以用来表示数据分布，通过将离散数据点分组归纳到箱子里。使用实例详见 bl.ock 3048450

# d3.layout.histogram()

# histogram(values[, index])

• x -箱的下界（包含）。
• dx -箱的宽度；x + dx为上界（不包含）。
• y - 计数（如果frequency`true`），或概率（如果frequency为`false`）。

# histogram.value([accessor])

# histogram.range([range])

# histogram.bins()
# histogram.bins(count)
# histogram.bins(thresholds)
# histogram.bins(function)

# histogram.frequency([frequency])

<此段需更新> 指定直方图的y值是否是一个计数（频率）或概率（密度）；默认值为频率。如果没有指定频数，则返回当前频率的布尔值。 <此段需更新>

``````Specifies the meaning of the generated bins’ *y*-values. If *frequency* is true, which is the default, the *y*-value represents the count of elements in the bin. If false, it represents the probability of a random element in the sample population being in that bin. Note that this is a *probability*, not a *probability density*, and so for [irregular histograms](http://bl.ocks.org/mbostock/1624660), you must normalize the *y*-value by the bin width (`bin.y / bin.dx`) for the area of the displayed bar to be proportional to the probability. If *frequency* is not specified, returns the current frequency boolean.
``````

• 张烁译 20140430
• 咕噜校对 2014-11-30 10:42:08

# Data-Driven Documents

### Translations (Unofficial)

##### Clone this wiki locally
You can’t perform that action at this time.
Press h to open a hovercard with more details.