﻿ Histogram | Documents for Excel .NET Edition | GCDocuments
Documents for Excel .NET Edition | GCDocuments
Features / Chart / Chart Types / Statistical Chart / Histogram
In This Topic
Histogram
In This Topic

Histograms are visual representation of data distribution over a continuous interval or certain time period. These charts comprise vertical bars to indicate the frequency in each interval or bin created by dividing the raw data values into a series of consecutive and non-overlapping intervals. Hence, histograms help in estimating the range where maximum values fall as well as in knowing the extremes and gaps in data values, if there are any. For instance, histogram can help you find the range of height in which maximum students of a particular age group fall.

### Using Code

Refer to the following code to add a Histogram chart.

C#
Copy Code
```    public void HistogramChart()
{
// Initialize workbook
Workbook workbook = new Workbook();
// Fetch default worksheet
IWorksheet worksheet = workbook.Worksheets[0];

// Prepare data for chart
worksheet.Range["A1:B11"].Value = new object[,]
{
{"Complaint", "Count"},
{"Too noisy", 27},
{"Overpriced", 789},
{"Food is tasteless", 65},
{"Food is not fresh", 19},
{"Food is too salty", 15},
{"Not clean", 30},
{"Unfriendly staff", 12},
{"Wait time", 109},
{ "No atmosphere", 45},
{"Small portions", 621 }
};
worksheet.Range["A:B"].Columns.AutoFit();
IShape histogramchartShape = worksheet.Shapes.AddChart(ChartType.Histogram, 300, 30, 300, 250);

// Set range"A1:B11" as the histogram chart series