Class pv.histogram
Represents a histogram operator.
Defined in: Histogram.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.histogram(data, f)
Returns a histogram operator for the specified data, with an optional
accessor function.
|
Method Attributes | Method Name and Description |
---|---|
bins(ticks)
Returns the computed histogram bins.
|
|
frequency(x)
Sets or gets whether this histogram operator returns frequencies or
probabilities.
|
- Parameters:
- {array} data
- an array of numbers or objects.
- {function} f Optional
- an optional accessor function.
The returned array contains pv.histogram.Bins. The x attribute corresponds to the bin's start value (inclusive), while the dx attribute stores the bin size (end - start). The y attribute stores either the frequency count or probability, depending on how the histogram operator has been configured.
The pv.histogram.Bin objects are themselves arrays, containing the data elements present in each bin, i.e., the elements in the data array (prior to invoking the accessor function, if any). For example, if the data represented countries, and the accessor function returned the GDP of each country, the returned bins would be arrays of countries (not GDPs).
- Parameters:
- {array} ticks Optional
- Returns:
- {array}
- Parameters:
- {boolean} x Optional
- Returns:
- {pv.histogram} this.