Histogram

A histogram is a chart that displays data distribution, using bars to represent the frequency of data points within a certain range. The height (or length) of each bar represents the number of data points falling within a specific interval, the X-axis represents the range of data values, and the Y-axis represents the frequency or count. Histograms are primarily used to represent the distribution of continuous variables and help analyze the central tendency, dispersion, and shape of data. The difference between a histogram and a bar chart: a histogram reflects data distribution, while a bar chart only compares values. In terms of data structure, a bar chart requires a categorical variable that is discrete (e.g., Class 1, Class 2, Class 3), so there are gaps between bars. But histogram data consists of continuous numerical variables (e.g., scores), so there are no gaps between bars.

Use Cases

  • Observe data distribution patterns, such as normal distribution, skewed distribution, etc.
  • Identify central regions and extreme values in data, helping analyze data variability and centrality.
  • Process continuous data by dividing it into multiple intervals and counting the frequency of each interval.

Visual Examples

Distribution of 200 students exam scores (normal distribution)

Product weight distribution (150 samples), custom colors

Bimodal distribution data, custom colors

Options

Configuration Options

PropertyTypeRequiredDescription
typestringrequiredValue must be "histogram".
datanumber[]requiredChart data.
binNumbernumberoptionalNumber of bins in the histogram.
titlestringoptionalChart title.
axisXTitlestringoptionalX-axis title.
axisYTitlestringoptionalY-axis title.
theme'default' | 'dark' | 'academy'optionalChart theme, default is "default".
styleObjectoptionalChart style.
style.backgroundColorstringoptionalMust be a valid color value.
style.palettestring[]optionalMust be an array of valid color values.