Sub topic 9
Titles, axes, legends, and data labels
This chapter assumes you can already insert a column, bar, line, or pie chart from a selected range and know what a series and a category are. Here you will learn to control the text and scaffolding around the plotted data: the chart title, axis titles, axis scale, legend, and data labels. Most unclear charts come from decisions about these elements, not from the chart type.
Where the elements live
Select the chart, then use either of these:
- The Chart Elements button (the green plus sign at the chart's upper right). Tick a box to show an element. The arrow beside an element lists options such as position.
- Chart Design > Add Chart Element, which offers the same choices as menus.
For detailed settings, right-click an element and choose Format .... This opens a task pane on the right with every option for that element.
| Element | What it does | Typical decision |
|---|---|---|
| Chart title | Names the chart | Say what the chart shows, not just the series name |
| Axis titles | Name the category and value axes and give the units | Add a value-axis title whenever the unit is not obvious |
| Axes | Provide scale and category labels | Set minimum, maximum, and number format |
| Legend | Maps colors to series (or to categories in a pie) | Remove it when there is only one series |
| Data labels | Print values on the marks | Use them when exact numbers matter more than the scale |
| Gridlines | Help the eye read values | Keep light and sparse, or remove if you use data labels |
Chart titles
When you insert a chart from a range with a single series, Excel often fills the title with the series name, such as "Sales". That is rarely enough. Click the title once to select it, then click again to edit the text. Write a title that states the subject, the measure, and the period if it applies, for example "Sales by Region, Q3".
You can also link a title to a cell, so it updates when the cell changes:
- Select the title (a single click on its border).
- Click in the formula bar.
- Type
=and click the cell that holds the text, then press Enter.
A linked title shows the cell's text. If the cell contains a formula such as ="Sales as of "&TEXT(B7,"d mmm yyyy"), the title updates with it.
To place the title, use Add Chart Element > Chart Title and choose Above Chart or Centered Overlay. Overlay saves space but can cover the data, so use it only when the plot has empty room.
Axes and axis titles
Column, bar, and line charts have two axes. In a column chart the category axis is horizontal and the value axis is vertical. In a bar chart the two swap places: categories run down the left, values run along the bottom.
Axis titles
Add them with Chart Elements > Axis Titles. Name the unit on the value axis ("Units sold", "Revenue (USD thousands)"). The category axis title is optional when the labels explain themselves, as with region names, but useful for something like "Month".
Scale options
Double-click the value axis to open Format Axis. Under Axis Options you can set:
- Minimum and Maximum. Excel picks these automatically. Typing a value locks it, and the field shows a reset option.
- Major and Minor units, which control the spacing of tick marks and gridlines.
- Display units, such as Thousands or Millions, which shortens labels like 1,200,000 to 1.2.
- Logarithmic scale, for data that spans several orders of magnitude. All values must be positive.
- Categories in reverse order, available on the category axis.
Number format
Under Format Axis > Number, choose a category such as Currency or a custom code. A format code like #,##0,"K" shows 12,500 as 13K. If you tick Linked to source, the axis uses the cell formatting from your data instead.
Bar charts list categories upside down
In a bar chart, the first row of your data appears at the bottom. To match the worksheet order, select the vertical (category) axis, open Format Axis, and tick Categories in reverse order. This moves the value axis labels to the top. To bring them back to the bottom, set Horizontal axis crosses to At maximum category in the same pane.
Date axes in line charts
If the category column holds real dates, Excel uses a date axis and spaces points by calendar time. A gap in the dates shows as a gap in the line's spacing. If you would rather space the points evenly, set Axis Type to Text axis in the category axis options. Dates stored as text always produce a text axis.
Legends
The legend identifies each series by color. Add or position it with Chart Elements > Legend (Top, Right, Bottom, Left) or Format Legend.
Use these rules:
- With one series, delete the legend. It repeats the title and wastes space.
- With several series, place the legend where reading order is natural, usually Top or Bottom for wide charts and Right for tall ones.
- In a pie chart, the legend lists categories, not series, because a pie has one series whose slices are the categories. Often you can drop the legend and label the slices directly (see below).
- To hide one entry, click the legend once, click the specific entry, and press Delete. This is useful for helper series, but the series is still plotted.
Data labels
Data labels print values on or beside each mark. Turn them on with Chart Elements > Data Labels, then open Format Data Labels for these options:
- Label Contains: Series Name, Category Name, Value, and for pie charts Percentage. You can tick several. The Separator setting controls what goes between them.
- Label Position: for columns and bars, Center, Inside End, Inside Base, or Outside End. For line charts, Above, Below, Left, Right, or Center. For pie charts, add Best Fit.
- Number format, so labels can show currency or one decimal place independent of the cells.
- Show Leader Lines, which connect moved labels back to their slices or points.
Choose between labels and gridlines. Labels give exact numbers. Gridlines give a rough read. Using both adds clutter, so when you add labels, consider removing gridlines and even the value axis.
Pie charts need special care. The default label shows the value. To show each region's share, tick Percentage and untick Value. With many small slices, labels collide. Move them manually (click a label twice, then drag), use Outside End, or group the small slices into "Other" in your data.
To change one label, click the label twice so only that label is selected, then edit or format it. This is how you highlight a single point, such as the highest column.
Setting the elements with VBA
The same settings are available in code. This macro assumes the chart from the earlier VBA example is the first chart object on the active sheet.
Sub ConfigureChartElements()
Dim ch As Chart
Set ch = ActiveSheet.ChartObjects(1).Chart
ch.HasTitle = True
ch.ChartTitle.Text = "Sales by Region, Q3"
ch.HasLegend = False
With ch.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Region"
End With
With ch.Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Units sold"
.MinimumScale = 0
.MaximumScale = 160
.MajorUnit = 40
End With
ch.SeriesCollection(1).HasDataLabels = True
End SubDo not call ch.Axes on a pie chart. Pies have no axes, and the call raises a run-time error.
Common errors
- Title says "Chart Title" or the series name. Edit the text; Excel's default is a placeholder.
- Value axis does not start at zero on a column chart. Reset Minimum to 0.
- Legend shows "Series1". The series has no name. Use Select Data to give it one.
- Labels overlap. Reduce the number of labeled points, change the position, or enlarge the chart.
- Dates spaced unevenly in a line chart. The axis is a date axis. Switch to Text axis if you want even spacing.
- Axis title is missing the unit. Add it, because readers cannot tell thousands from millions otherwise.
Exercise
A column chart shows one series, "Sales", for four regions. It has a legend, a value axis that starts at 80, and no data labels. List three changes that make it clearer and honest, and say how to make each one in Excel.
Show answer
1) Remove the legend, since one series makes it redundant: select the legend and press Delete, or clear Legend under Chart Elements. 2) Reset the value axis minimum to 0: double-click the value axis, open Format Axis, and set Minimum to 0, because column length encodes value and a truncated axis exaggerates differences. 3) Add data labels so readers see exact numbers: Chart Elements > Data Labels, then choose Outside End under Label Position. You could also give the value axis a title with the unit, such as "Units sold".
Exercise
You build a pie chart of sales share by region. You want each slice to show its percentage, not its value, and you try to add an axis title. What do you do, and what happens with the axis title?
Show answer
Open Format Data Labels, tick Percentage and untick Value. A pie chart has no axes, so there is no axis title to add, and the Axis Titles option is not available. Name the measure in the chart title instead, for example "Share of Sales by Region".