charting primer i
TRANSCRIPT
-
7/29/2019 Charting Primer I
1/47
Excel Charting Primer I
Charting Missing Data
Modifying Chart Series
Create a Chart with Series Formulas
Combination Charts
Use 2 Value Axes in a Chart
Graphical Fills
Dynamic Chart Titles
XY vs. Line Chart Types
Correcting Misleading Chart Scales
Managing Category DatesCreating a Chart with Multiple Category Labels
Locate Chart Tick Marks
Adding Labels to XY and Bubble Chart Data Points
3-D Chart Basics
Many of the examples in this workbook wereadapted from the text named Excel Charts, by
John Walkenbach, Wiley, 2003.
-
7/29/2019 Charting Primer I
2/47
3 Ways to Chart Missing Data
Charting Missing DataThe three charts in this worksheet show three ways to handle missing data.
In the first chart the missing data is not plotted, in the second the missing
data is plotted as zeros, and in the third Excel interpolates the missing data.
The Data
Time Temperature
12:00 AM 28
1:00 AM 27
2:00 AM 27
3:00 AM 24
4:00 AM 26
5:00 AM 32
6:00 AM 35
7:00 AM 38
8:00 AM 40
9:00 AM
10:00 AM 45
11:00 AM 47
12:00 PM 50
1:00 PM 52
2:00 PM 52
3:00 PM 50
4:00 PM 43
5:00 PM
6:00 PM 36
7:00 PM 34
8:00 PM 32
9:00 PM 30
10:00 PM 29
11:00 PM 28
0
10
20
30
40
50
60
12:00 AM 3:00 AM 6:00 AM 9:00 AM 12:00 PM 3:00 PM 6:00 PM 9:00 PM
TemperatureChart 1 - Missing Data Not Plotted
0
10
20
30
40
50
60
12:00 AM 3:00 AM 6:00 AM 9:00 AM 12:00 PM 3:00 PM 6:00 PM 9:00 PM
TemperatureChart 2 - Missing Data Not Plotted as Zeros
0
10
20
30
40
50
60
12:00 AM 3:00 AM 6:00 AM 9:00 AM 12:00 PM 3:00 PM 6:00 PM 9:00 PM
TemperatureChart 3 - Missing Data Interpolated
Return to Contents
-
7/29/2019 Charting Primer I
3/47
Manipulate Chart Series
Manipulate Chart Series
Chart 1: A column chart using data in Data Range 1 with the quarterly sales values as
the data series and the regions as the categories. Change the Q1 Sales series name from"Q1 Sales" to "Quarter 1 (Millions"). The plotting order is changed so the quarter 2 series
markers appear to the left of the quarter 1 series markers and "Q2 Sales" is the top row.
of the legend.
Chart 2: A copy of Chart 1 with these changes:
1) All series removed but North, South, East, and West.
2) North, South, East, and West data added for quarters 3 and 4 from Data Range 2.
3) Y-axis scale chaned from $0 to $70 to $0 to $80 and display labels by 20s on the axis
(that is, $0, $20, $40, $60, $80, and $100) instead of by 10s.
4) A chart data table added.
Data Range 1
Region Q1 Sales Q2 Sales
North $50 $55
South $45 $42
East $32 $35
West $58 $50
Central $40 $43
NorthWest $35 $35
NorthEast $30 $28
SouthWest $38 $45
SouthEast $42 $48
Data Range 2
Region Q3 Sales Q4 Sales
North $58 $56
South $41 $40
East $37 $38West $49 $52
Central $46 $47
NorthWest $37 $34
NorthEast $24 $22
SouthWest $47 $48
SouthEast $48 $45
$0
$10
$20
$30
$40
$50
$60
$70
North South East We
North
Q2 Sales $55
Quarter 1 (Millions) $50
Q3 Sales $58
Q4 Sales $56
$0
$20
$40
$60
$80
Q2 Sales
-
7/29/2019 Charting Primer I
4/47
Creating a
Create a Chart by Specifying its SeriesThe series function in the chart below generates the bar markers
The data for the chart doesn't exist anywhere but in the SERIES
statement, which is =SERIES(,{"Films","Books","Music"},{2, 9, 7},1)
The copy of the chart below has been modified to column from p
The SERIES formula has been changed so that Films, Books, and
Music constitute a single data marker with a total of 18 hours and
Cooking, and Dusting are a second data marker with a total of 6 h
A legend has been included and functions as this chart's title.
Below is the text for the series function that will create this seco
=SERIES("Hours Per Week: Entertainment vs. Housekeep
When displaying the formula in the worksheet, precede the formu
a single quote mark so Excel doesn't attempt to interpret the tex
actual formula.
* Note
To create a chart using only a series formula, start the Chart Wiz
Wizard as usual but without selecting any data beforehand. In th
Wizard's Step 1 select a chart type. Click the Wizard's Finish
button immediately. With the empty rectangle the Wizard has
allocated selected (Illustr. 1) , click in Excel's Formula Bar enter
series function that defines your chart. Excel creates the basic
chart (Illustr. 2 ). Add whatever formatting you like.
Films, 2
Books, 9
Music, 7
Hours Per Week: Entertainment
Films
Books
Music
18
6
0
5
10
15
20
Films, Books & Music Laundry, Cooking, &Cleaning
Hours Per Week: Entertainment vs. Housekeeping
-
7/29/2019 Charting Primer I
5/47
Combination ChartsCreate a combination chart by creating a standard chart first and then
converting one or more of the chart series to a different chart type.
Region Q1 Sales Q2 Sales Q3 Sales Q4 SalesNorth $50 $55 $60 $65
South $45 $42 $39 $36
East $32 $35 $38 $41
West $58 $50 $42 $34
Central $40 $43 $46 $49
Excel offers a few built-in combination charts on its Chart Wizard Step 1
on its "Custom Types" tab, but it's easy to customize your own combination.
$0
$20
$40
$60
$80
North South East West Central
Q4 Sales Q1 Sales Q2 Sales Q3 Sales
Column and Line Combination Chart
$0
$20
$40
$60
$80
North South Eas
Q3 Sales Q4 Sales
Column, Area, and Line
-
7/29/2019 Charting Primer I
6/47
-
7/29/2019 Charting Primer I
7/47
t West Central
Q1 Sales Q2 Sales
ombination Chart
Return to Contents
-
7/29/2019 Charting Primer I
8/47
A Chart with Two Value AxesWhen the data you're charting varies dramatically in scale,
a chart with two value axes may be the best solution. March
The first chart on this worksheet uses a single value axis. April
The second chart is modified so Income values use the left-hand MayY axis and Profit Margin values use a new right-hand Y axis. June
The left-hand Y axis scale is changed so it ranges from 170,000 July
to 2,970,000 with a "Major Unit" of 700,000. The right-hand August
Y axis scale is changed to start at 9%. September
9.0%
10.0%
11.0%
12.0%
13.0%
14.0%
15.0%
$170,000
$870,000
$1,570,000
$2,270,000
$2,970,000
March April May June July August September
Income
Profit Margin
Data Charted With Two Value Axes
Inco
me
$-
$850,000
$1,700,000
$2,550,000
$3,400,000
March April May June July August September
Income
Profit Margin
Data Charted With One Value Axis
-
7/29/2019 Charting Primer I
9/47
-
7/29/2019 Charting Primer I
10/47
Income Profit Margin
2,455,682$ 12.5%
2,022,515$ 11.2%
1,899,588$ 10.1%2,450,385$ 14.5%
2,885,626$ 14.1%
1,993,285$ 13.2%
1,988,659$ 10.9%
Return to Contents
-
7/29/2019 Charting Primer I
11/47
-
7/29/2019 Charting Primer I
12/47
Examples of Charts with Graphical Fills
Copy a chart and pas
from its underlying d
$1
$500,001
$1,000,001
$1,500,001
$2,000,001
$2,500,001
$3,000,001
Plot Ar
$-
$500,000
$1,000,000
$1,500,000
$2,000,000
$2,500,000
$3,000,000
March April May0.0%
2.0%
4.0%
6.0%
8.0%
10.0%
12.0%
14.0%
Line Chart Plot Area with Graphical Fill
Pie Chart with a
Graphic in One Slice
Quarter 1 Quarter 2 Quarter 3
Chart
-
7/29/2019 Charting Primer I
13/47
Chart Data
Quarter 1 Quarter 2 Quarter 3
Apr 12 3 56
Feb 145 5 44
Mar 16 88 67
0 1
January
Feb
Mar
Apr
May
Jun
-
7/29/2019 Charting Primer I
14/47
e special as a picture to separate the chart
ta. Ungroup the elements to manipulate them.
March April May
a with Graphical Fill and Chart
eries with Graphical Fill
with Formatted Legend
Quarter 1
Quarter 2
Quarter 3
Return to Contents
-
7/29/2019 Charting Primer I
15/47
A Graphic (Once a Chart)Edited as a Picture
20 30 40 50 60
New DataOld Data
-
7/29/2019 Charting Primer I
16/47
Dynamic Chart TitlesMake chart titles dynamic if you want them to change
automatically as values in your worksheet change.
Q1 Q2 Q3Feb 104 75 56 Referenced value: Southern (Change this value
Mar 115 86 44
Concatenation: Values from the Southern Regio
How to create a dynamic chart title:
1. Create the chart, leaving off a main title.
2. Locate in a worksheet cell (or cells) the values
the title to take on. If using values from more t
create the title you want in another cell using
3. Select the chart.
4. Click in the formula bar, enter an equals sign,
the cell that holds the title value or the concat
you want. Hit the enter key.0
40
80
120
Q1 Q2 Q3
Feb
Mar
Values from the Southern Region
-
7/29/2019 Charting Primer I
17/47
o change the chart title.)
ou want
han one cell,
xcel concatenation.
nd reference
nated value
Return to Contents
-
7/29/2019 Charting Primer I
18/47
The XY (Scatter) vs. the Line ChartThe relationship between data points is best plotted with Year
an XY or Scatter plot for certain kinds of data. Below is 0
an XY chart type of the population data in this worksheet. 1000
Below that is a line chart of the same data. The line chart 1250assumes the X axis is non-numeric and that the years are 1500
equally spaced in the data, which is not the case. The line 1750
chart gives a misleading view of the data. 1800
1850
1900
1910
1920
1930
1940
1950
1960
1970
1980
1990
1999
2000
2010
2020
2030
2040
2050
2100
2150
D
0
24
6
8
10
12
0 500 1000 1500 2000 2500
Year (plotted against population figures)
Population(billions)
Population Growth: XY Chart
0
2
46
8
10
12
0 1500 1850 1920 1950 1980 2000 2030 2100
Population Growth: Line Chart
Year (plotted as category values)
Population
-
7/29/2019 Charting Primer I
19/47
Population (billions)
0.01
0.20
0.400.65
0.78
0.90
1.20
1.65
1.75
1.85
1.95
2.05
2.59
2.70
3.10
3.80
4.30
4.85
5.40
5.95
6.50
8.11
8.58
8.91
9.46
9.75
taReturn to Contents
-
7/29/2019 Charting Primer I
20/47
Misleading Scales/Consistent Chart ScalesIf creating several charts of like data, it's often best to Survey Questi
make sure the chart scales remain the same so the data Excellent
can be compared accurately across charts. The first two Very Good
charts below appear to be charting data that's quite similar, Goodbut this is because the value scales are different. See the Not Good
third chart below that uses the same scale as the first. Unsatisfactory
Survey Questi
Excellent
Very Good
Good
Not Good
Unsatisfactory
This third chart is based on fewer responses. The scale of this chart matches the scale
of the first chart, making it easier to compare responses accurately across charts.
0.0% 10.0% 20.0% 30.0% 40.0% 50.0%
Excellent
Very Good
Good
Not Good
Unsatisfactory
Survey Question 1 Responses (Scale 0-50%)
0.0% 5.0% 10.0% 15.0% 20.0%
Excellent
Very Good
Good
Not Good
Unsatisfactory
Survey Question 2 Responses (Scale 0-20%)
Good
Not Good
Unsatisfactory
Survey Question 2 Responses (Scale 0-50%)
-
7/29/2019 Charting Primer I
21/47
0.0% 10.0% 20.0% 30.0% 40.0% 50.0%
Excellent
-
7/29/2019 Charting Primer I
22/47
n 1 Responses
3.0%
4.9%
24.4%41.5%
26.2%
100.0%
n 2 Responses
2.9%
4.0%
11.0%
16.0%
12.0%
45.9%
Return to Contents
-
7/29/2019 Charting Primer I
23/47
The Date-Based Category Chart AxisIf you create a chart using time or date data as category data, Sale Date
Excel automatically creates equal intervals between values 10/5/2003
even if that means adding new category information to what 10/7/2003
you're charting. For example, the chart below shows equally 10/12/2003spaced dates on the category (X) axis, although the data 10/18/2003
itself (at right) does not have dates equally spaced. 10/23/2003
10/24/2003
10/28/2003
If you prefer you can turn off this Excel charting feature. Open the
"Chart Options" dialog for the chart and on the "Axes" tab change
the selected option for the category axis from "Automatic" to "Category".
$0.0 $2.0 $4.0 $6.0 $8.0
10/5/2003
10/7/2003
10/9/2003
10/11/2003
10/13/2003
10/15/2003
10/17/2003
10/19/2003
10/21/2003
10/23/2003
10/25/2003
10/27/2003
Sales (Thousands)
Equally-spacedDatesSup
pliedbyExcel
10/7/2003
10/12/2003
10/18/2003
10/23/2003
10/24/2003
10/28/2003
Sales (Thousands)
DatesFromtheData
Only
-
7/29/2019 Charting Primer I
24/47
$0.0 $2.0 $4.0 $6.0 $8.0
10/5/2003
-
7/29/2019 Charting Primer I
25/47
Sales (Thousands)
$5.3
$4.5
$6.6$5.8
$3.2
$5.1
$4.8
Return to Contents
-
7/29/2019 Charting Primer I
26/47
-
7/29/2019 Charting Primer I
27/47
Using Multiple Category LabelsExcel can recognize and use multiple rows or columns of category
values in a single chart.
To correct Excel's interpretation of the data, use the "Series" tab in the
"Source Data" chart dialog. Note that data used for the multiple category
names must be contiguous.
0
5
10
15
20
25
China Japan Croatia Russia Canada Mexico
Far East Eastern Europe West
Month
ContactsExcel's Interpretation of the Data to Chart
0
5
10
15
20
25
10 11 10 11 10 11
China Japan Croatia Russia Canada Mexico
Far East Eastern Europe West
Multiple Category Labels Reinterpreted to include Months
Numb
erofContactsMade
-
7/29/2019 Charting Primer I
28/47
Data to Chart
Region Countries Month Contacts
Far East China 10 15
Japan 11 16
Eastern Europe Croatia 10 12Russia 11 10
West Canada 10 18
Mexico 11 23
Category Labels
Return to Contents
-
7/29/2019 Charting Primer I
29/47
Controlling Chart Tick Mark Labels Data to ChartWith some charts you may want to override Excel's -5
standard positioning of tick mark labels -3
-1
35
8
Use the "Format Axis" dialog and the "Patterns" tab to
control tick mark label positioning on a chart.
-6
-4
-2
0
2
4
6
8
10
1 2 3 4 5 6
Standard Tick Mark Label Position
-6
-4
-2
0
2
4
6
8
10
1 2 3 4 5 6
Tick Mark Labels Specified "Low"
Tick Mark Labels Specified "High"
-
7/29/2019 Charting Primer I
30/47
-6
-4
-2
0
2
4
6
8
101 2 3 4 5 6
-
7/29/2019 Charting Primer I
31/47
Return to Contents
-
7/29/2019 Charting Primer I
32/47
Labeling XY and Bubble Chart Data PointsExcel has no way for you to specify a range of text to be used as
data labels for the values plotted in XY or Scatter charts. Labels
can be added manually, or third-party utilities are available to
make a labeling feature available to your XY chart. Microsoft alsoprovides instructions* on its Knowledge Base website for creating
a VBA program to add XY labels. That VBA code is used to label
the data points in the scatter and bubble plot examples here.
* See http://support.microsoft.com/default.aspx?scid=kb;en-us;213750
SUMMARY
Excel has no built-in commandto automatically attach text labels to
data points in an xy (scatter) or Bubble chart. However, you can create a
Visual Basic for Applications macro that does this. Below is a macro that
performs this task on an XY Scatter chart. It can also be used for a Bubble Chart.
The sample code in this article assumes that the data and associated labels
are arranged in a worksheet according to the following format: The first
column contains the data labels. The second column contains the x values
for the xy (scatter) chart. The third and subsequent columns contain the y
values for the xy (scatter) chart.NOTE: Although the example provided contains only one column of data for
y values, you can use more than one series of data.
To use the macro described here, create a chart using the following data:
A1: Labels B1: X Values C1: Y Values
A2: DataPoint1 B2: 12 C2: 5
A3: DataPoint2 B3: 9 C3: 7
Kirin
Badger
Foo Dog Bean Thrower
Mirror Polisher
0
4
8
12
16
20
$20 $25 $30 $35 $40 $45
Netsuke Demand by Price and Model- as XY (Scatter) Plot -
Demand
Price
http://support.microsoft.com/default.aspx?scid=kb;en-us;213750http://support.microsoft.com/default.aspx?scid=kb;en-us;213750 -
7/29/2019 Charting Primer I
33/47
A4: DataPoint3 B4: 5 C4: 3
A5: DataPoint4 B5: 4 C5: 8
A6: DataPoint5 B6: 1 C6: 4
NOTE: The table should not contain empty columns, and the column that contain
data labels should not be separated from the column that contains the x values.
labels and values must be laid out in exactly the format described in this article
(the location of the upper-left cell does not have to be cell A1).
To attach text labels to data points in an xy (scatter) chart, follow these steps:
- Create an XY chart in the usual fashion.
- Press ALT+F11 to open Excel's Visual Basic for Applications environment.
- On the VBA Insert menu, click Module to create a code window.
- Type the following sample code in the module sheet (or copy & paste from
Sub AttachLabelsToPoints()
'Dimension variables.
Dim Counter As Integer, ChartName As String, xVals As String
' Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
'Store the formula for the first series in "xVals".
xVals = ActiveChart.SeriesCollection(1).Formula
'Extract the range for the data from xVals.
xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1)
Do While Left(xVals, 1) = ","
xVals = Mid(xVals, 2)
Loop'Attach a label to each data point in the chart.
For Counter = 1 To Range(xVals).Cells.Count
ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel
True
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.T
Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
Next Counter
End Sub
- Press ALT+Q to return to Microsoft Excel.
- Select the chart.- From Excel's menus choose Tools, Macro, Macros. Click AttachLabelsToP
and then click Run to run the macro.
The macro automatically associates the labels with the data points on the c
-
7/29/2019 Charting Primer I
34/47
Bubble Size**
Netsuke Price Demand Availability
Kirin $22 8 3
Badger $38 12 5
Foo Dog $32 10 4Bean Thrower $42 5 1
Mirror Polisher $28 15 8
** This column of data is used in the bubble chart only. The bubble size
gives a quick visual indication of the "availability" dimension in the data.
Kirin
Badger
Foo Dog Bean Thrower
Mirror Polisher
4
8
12
16
20
$15 $20 $25 $30 $35 $40 $45 $50
Netsuke Demand by Price, Model, & Availability- as Bubble Chart -
Price
Demand
Return to Contents
-
7/29/2019 Charting Primer I
35/47
s the
he
here):
= _
xt = _
oints,
art.
-
7/29/2019 Charting Primer I
36/47
Kirin Badger Foo Dog Mirror Polisher
Bean Thrower
-
7/29/2019 Charting Primer I
37/47
3-D Chart BasicsExcel has some built-in 3-D chart types. The 3-D chart here Chart Data
is shown in six different views. Because it can be difficult Year
to select a 3-D chart element, remember that the Chart 2000
Toolbar has a drop-down list of elements that can be used 2001for selection. 2002
View 2: Th
View 1: A standard 3-D column chart. Select the
View 4: The 3-D chart with a Z Value axis added. The data isn't all
visible in this view and with this arrangement of the data. The "Chart
-
1,500
3,000
4,500
6,000
2000 2001 2002
Labrador
Corgi
Bedlington
Dogs Registered with the AKC by Breed
-
7/29/2019 Charting Primer I
38/47
View 6: The data series modified so all data is visible; the chart rotated. The "Forma
Labrador
Corgi
Bedlington
-
1,500
3,000
4,500
6,000
20002001
2002
Dogs Registered with the AKC by Breed
Bedlington
Corgi
Labrador
-
1,500
3,000
4,500
6,000
20002001
2002
Dogs Registered with the AKC by Breed
-
7/29/2019 Charting Primer I
39/47
-
7/29/2019 Charting Primer I
40/47
Labrador Corgi Bedlington
2,030 524 82
4,325 638 1045,112 929 203
"frame view" (w/CONTROL depressed to show shapes).
hart "Corners" element and use this view to control perspective. View 3: The chart with perspect
Options" dialog "Axes" tab with all 3 axes selected. View 5: An incomprehensible 3-
-
1,500
3,000
4,500
6,000
Dogs Registered w
Return to Contents
-
7/29/2019 Charting Primer I
41/47
t Data Series" dialog with its "Series Order" tab.
2000
2001
2002
Dogs Registere
-
7/29/2019 Charting Primer I
42/47
-
7/29/2019 Charting Primer I
43/47
ive altered by dragging the Corners element.
Use the "Chart Options" "3-D View" dialog and its Defa
view of the data. button to return the chart to a standard perspective.
Labrador
Corgi
Bedlington
ith the AKC by Breed
-
7/29/2019 Charting Primer I
44/47
Labrador
Corgi
Bedlington
-
1,500
3,000
4,500
6,000
with the AKC by Breed
-
7/29/2019 Charting Primer I
45/47
-
7/29/2019 Charting Primer I
46/47
ult
-
7/29/2019 Charting Primer I
47/47