Make the First Choice
| Question or detail | Chart | What to check |
|---|---|---|
| Input | Bar Chart | A category and an aggregate value, such as orders by channel. |
| Input | Histogram | Numeric observations, or interval boundaries with counts, such as order values. |
| Ordering | Bar Chart | Categories may be ranked or follow a meaningful category order. |
| Ordering | Histogram | Intervals stay in numeric order and retain their widths. |
WORKED EXAMPLE / ILLUSTRATIVE DATA
Two Questions About the Same Six Orders
Here is a small fictional order dataset. Each row includes a category and a numeric amount. Either chart can use these records, but each answers a different question.
| Order | Channel | Amount ($) |
|---|---|---|
| 1 | Website | 12 |
| 2 | Store | 18 |
| 3 | Website | 24 |
| 4 | Marketplace | 27 |
| 5 | Store | 42 |
| 6 | Website | 48 |
For orders by channel, bar heights are Website 3, Store 2, and Marketplace 1. For order amounts in intervals [0, 20), [20, 40), and [40, 60), histogram counts are 2, 2, and 2. Both summaries use all six orders.
Do Not Decide From the Gaps Alone
Histogram rectangles commonly touch because neighboring intervals cover adjacent parts of a number line. Bar-chart gaps separate categories. Styling can blur that distinction, so inspect the input and axis meaning rather than relying only on appearance.
A zero-count interval still belongs in a histogram. Removing it closes a real gap in the numeric range. A category bar chart can show an absent category too, but its position is not a numeric distance.
Define Boundaries Before Counting
The notation [20, 40) includes 20 and excludes 40. Assign values on a boundary to exactly one interval. Document how the final upper boundary is handled so no observation is silently dropped.
If counts are already binned, plot those counts against their intervals. Passing the counts themselves into a histogram function creates a distribution of counts, which answers a different question. ChartTypes uses supplied bin counts and preserves them in each library preview.
A Numeric Label Can Still Be a Category
Bus route 12 and bus route 18 are identifiers. Their numeric labels do not make a histogram appropriate. By contrast, journey duration in minutes is a measurement that can be grouped into numeric intervals.
Keep the data table available so readers can see what was aggregated. If individual values matter more than the distribution, a dot plot or a compact table may be a better first view.
Before You Publish
- Identify whether x represents categories or numeric intervals.
- Check that every observation is counted exactly once.
- Keep pre-binned counts separate from raw observations.
Explore Working Examples
Open a chart to inspect its sample data and compare code in six libraries.