src/api/v4/dataview/histogram/index.js
function Histogram (source, column, options) {
  this._initialize(source, column, options);
  this._bins = this._options.bins;
  this._start = this._options.start;
  this._end = this._options.end;
}
function Histogram (source, column, options) {
  this._initialize(source, column, options);
  this._bins = this._options.bins;
  this._start = this._options.start;
  this._end = this._options.end;
}
function Histogram ( source , column , options ) { this . _initialize ( source , column , options ) ; this . _bins = this . _options . bins ; this . _start = this . _options . start ; this . _end = this . _options . end ; }
A histogram is used to represent the distribution of numerical data.

See {@link https://en.wikipedia.org/wiki/Histogram}.

@param {carto.source.Base} source - The source where the dataview will fetch the data
@param {string} column - The column name to get the data
@param {object} [options]
@param {number} [options.bins=10] - Number of bins to aggregate the data range into
@param {number} [options.start] - Lower limit of the data range, if not present, the lower limit of the actual data will be used. Start and end values must be used together.
@param {number} [options.end] - Upper limit of the data range, if not present, the upper limit of the actual data will be used. Start and end values must be used together.

@fires dataChanged
@fires columnChanged
@fires statusChanged
@fires error

@fires binsChanged

@constructor
@extends carto.dataview.Base
@memberof carto.dataview
@api
@example
// Create a cities population histogram.
var histogram = new carto.dataview.Histogram(citiesSource, 'population');
// Set up a callback to render the histogram data every time new data is obtained.
histogram.on('dataChanged', renderData);
// Add the histogram to the client
client.addDataview(histogram);
@example
// Create a cities population histogram with only 4 bins
var histogram = new carto.dataview.Histogram(citiesSource, 'population', {bins: 4});
// Add a bounding box filter, so the data will change when the map is moved.
var bboxFilter = new carto.filter.BoundingBoxLeaflet(map);
// Set up a callback to render the histogram data every time new data is obtained.
histogram.on('dataChanged', histogramData => {
console.log(histogramData);
});
// Add the histogram to the client
client.addDataview(histogram);
@example
// Create a cities population histogram with a range
var histogram = new carto.dataview.Histogram(citiesSource, 'population', { start: 100000, end: 5000000 });
// Set up a callback to render the histogram data every time new data is obtained.
histogram.on('dataChanged', histogramData => {
console.log(histogramData);
});
// Add the histogram to the client
client.addDataview(histogram);
@example
// The histogram is an async object so it can be on different states: LOADING, ERROR...
// Listen to state events
histogram.on('statusChanged', (newStatus, error) => { });
// Listen to histogram errors
histogram.on('error', error => { });
A histogram is used to represent the distribution of numerical data .