Sie sind auf Seite 1von 49

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 Dates
Creating 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 were


adapted from the text named Excel Charts, by
John Walkenbach, Wiley, 2003.
3 Ways to Chart Missing Data

Charting Missing Data Return to Contents


The 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
Temperature
12:00 AM 28 Chart 1 - Missing Data Not Plotted
60
1:00 AM 27
2:00 AM 27 50

3:00 AM 24 40
4:00 AM 26 30
5:00 AM 32 20
6:00 AM 35 10
7:00 AM 38
0
8:00 AM 40
AM AM AM AM AM AM AM AM AM AM AM AM PM PM PM PM PM PM PM PM PM PM PM PM
9:00 AM 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 :0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 0 :0 1 :0 2 :0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 0 :0 1 :0
1 1 1 1 1 1
10:00 AM 45
11:00 AM 47
12:00 PM 50
Temperature
1:00 PM 52
Chart 2 - Missing Data Not Plotted as Zeros
2:00 PM 52 60

3:00 PM 50 50
4:00 PM 43 40
5:00 PM 30
6:00 PM 36 20
7:00 PM 34
10
8:00 PM 32
0
9:00 PM 30
10:00 PM 29 AM AM AM AM AM AM AM AM AM AM AM AM PM PM PM PM PM PM PM PM PM PM PM PM
: 0 0 :00 :0 0 :0 0 :00 :0 0 :00 :0 0 :0 0 :00 :0 0 :0 0 :0 0 :0 0 :00 :0 0 :0 0 :00 :0 0 :00 :0 0 :0 0 :0 0 :0 0
11:00 PM 28 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11

Temperature
Chart 3 - Missing Data Interpolated
60

50

40

30

20

10

0
AM AM AM AM AM AM AM AM AM AM AM AM PM PM PM PM PM PM PM PM PM PM PM PM
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 :0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 0 :0 1 :0 2 :0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 0 :0 1 :0
1 1 1 1 1 1
Manipulate Chart Series

Manipulate Chart Series Return to Contents

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
Chart 1
North $50 $55
South $45 $42 $70
Q2 Sales
East $32 $35 $60 Quarter 1 (Millions)
West $58 $50 $50
Central $40 $43
$40
NorthWest $35 $35
NorthEast $30 $28 $30
SouthWest $38 $45 $20
SouthEast $42 $48
$10

$0
Data Range 2 North South East West Central NorthWest NorthEast SouthWest SouthEast
Region Q3 Sales Q4 Sales
North $58 $56
South $41 $40
East $37 $38 Chart 2
$80
West $49 $52
Central $46 $47
NorthWest $37 $34
NorthEast $24 $22 $60
SouthWest $47 $48
SouthEast $48 $45

$40

$20

$0
North South East West

Q2 Sales Quarter 1 (Millions) Q3 Sales Q4 Sales


Creating a Chart by Writing Series Formulas

Create a Chart by Specifying its Series


The series function in the chart below generates the bar markers. Return to Contents
The data for the chart doesn't exist anywhere but in the SERIES
statement, which is =SERIES(,{"Films","Books","Music"},{2, 9, 7},1).

Hours Per Week: Entertainment

The copy of the chart below has been modified to column from pie.
The SERIES formula has been changed so that Films, Books, and
Music constitute a single data marker with a total of 18 hours and Laundry,
Cooking, and Dusting are a second data marker with a total of 6 hours.
A legend has been included and functions as this chart's title.
Below is the text for the series function that will create this second chart.

=SERIES("Hours Per Week: Entertainment vs. Housekeeping",{"Films, Books & Music","Laundry, Cooking, & Cleaning"},{18,6},1)

When displaying the formula in the worksheet, precede the formula with
a single quote mark so Excel doesn't attempt to interpret the text as an
actual formula.

Hours Per Week: Entertainment vs. Housekeeping


15

10

* Note
To create a chart using only a series formula, start the Chart Wizard
Wizard as usual but without selecting any data beforehand. In the
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 the
series function that defines your chart. Excel creates the basic
chart (Illustr. 2). Add whatever formatting you like.

Illustr. 1 Illustr. 2
Combination Charts Return to Cont
Create 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 Sales


North $50 $55 $60 $65
South $45 $42 $39 $36
East $32 $35 $38 $41
West $58 $50 $42 $34
Central $40 $43 $46 $49

Column and Line Combination Chart Column, Area, and Line Combination Chart
$80 $80

$60 $60

$40 $40

$20 $20

$0 $0
North South East West Central North South East West Centra
Q4 Sales Q1 Sales Q2 Sales Q3 Sales Q3 Sales Q4 Sales Q1 Sales Q2 Sale

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.
Return to Contents

Combination Chart

st West Central
Q1 Sales Q2 Sales
A Chart with Two Value Axes
When 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 May
Y 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

Data Charted With One Value Axis

$3,400,000

$2,550,000

$1,700,000

$850,000 Income
Profit Margin

$-
March April May June July August September

Data Charted With Two Value Axes


$2,970,000 15.0%

14.0%
$2,270,000
Profit Margin

13.0%
Income

$1,570,000 12.0%

11.0%
$870,000 Income
Profit Margin 10.0%

$170,000 9.0%
March April May June July August September
Profit Margin
13.0%

Income
$1,570,000 12.0%

11.0%
$870,000 Income
Profit Margin 10.0%

$170,000 9.0%
March April May June July August September
Income Profit Margin Return to Contents
$ 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%

15.0%

14.0%
Profit Margin

13.0%

12.0%

11.0%

10.0%

9.0%
tember
Profit Margin
13.0%

12.0%

11.0%

10.0%

9.0%
tember
Examples of Charts with Graphical Fills

Line Chart Plot Area with Graphical Fill Plot Area with Graphical Fill and Cha
$3,000,000 14.0%

12.0% $3,000,001
$2,500,000

10.0%
$2,000,000 $2,500,001

8.0%
$1,500,000 $2,000,001
6.0%

$1,000,000
4.0% $1,500,001

$500,000
2.0%
$1,000,001

$- 0.0%
March April May $500,001

$1
March Apri

Pie Chart with a


Graphic in One Slice Chart with Formatte

Quarter1 Quarter2 Quarter3


Copy a chart and paste special as a picture
from its underlying data. Ungroup the elem

A Graphic (Once a Chart)


Edited as a Picture

Chart Data

Jun
Quarter 1 Quarter 2 Quarter 3
Apr 12 3 56
Feb 145 5 44 May

Mar 16 88 67
Apr

Mar

Feb

January

0 10
Return to Contents

rea with Graphical Fill and Chart Series with Graphical Fill

$3,000,001

$2,500,001

$2,000,001

$1,500,001

$1,000,001

$500,001

$1
March April May

Chart with Formatted Legend

Quarter 1
Quarter 2
Quarter 3
hart and paste special as a picture to separate the chart
underlying data. Ungroup the elements to manipulate them.

A Graphic (Once a Chart)


Edited as a Picture

New Data
Old Data

10 20 30 40 50 60
Dynamic Chart Titles
Make chart titles dynamic if you want them to change
automatically as values in your worksheet change.

Q1 Q2 Q3
Feb 104 75 56 Referenced value: Southern (Change this value to change the c
Mar 115 86 44
Concatenation: Values from the Southern Region

Values from the Southern Region


120 How to create a dynamic chart title:
1. Create the chart, leaving off a main title.
Feb
Mar 2. Locate in a worksheet cell (or cells) the values you want
80 the title to take on. If using values from more than one cell,
create the title you want in another cell using Excel concaten
3. Select the chart.
40 4. Click in the formula bar, enter an equals sign, and reference
the cell that holds the title value or the concatenated value
you want. Hit the enter key.
0
Q1 Q2 Q3
Return to Contents

ge this value to change the chart title.)

uthern Region

s) the values you want


s from more than one cell,
er cell using Excel concatenation.

equals sign, and reference


or the concatenated value
The XY (Scatter) vs. the Line Chart Data
The 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 1250
assumes 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
Population Growth: XY Chart 1910
12 1920
Population (billions)

10 1930
8 1940
1950
6
1960
4
1970
2
1980
0 1990
0 500 1000 1500 2000 2500 1999
Year (plotted against population figures)
2000
2010
Population Growth: Line Chart 2020
12 2030
2040
Population (billions)

10

8 2050
2100
6
2150
4

0
0 50 50 50 10 30 50 70 90 00 20 40 00
12 17 18 19 19 19 19 19 20 20 20 21
Year (plotted as category values)
Data
Return to Contents
Population (billions)
0.01
0.20
0.40
0.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
Misleading Scales/Consistent Chart Scales
If creating several charts of like data, it's often best to Survey Question 1 Responses
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, Good
but 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 Question 1 Responses (Scale 0-50%) Survey Question 2 Responses


Excellent
Unsatisfactory Very Good
Good
Not Good Not Good
Unsatisfactory
Good

Very Good

Excellent

0.0% 5.0% 10.0% 15.0% 20.0% 25.0% 30.0% 35.0% 40.0% 45.0%

Survey Question 2 Responses (Scale 0-20%)

Unsatisfactory

Not Good

Good

Very Good

Excellent

0.0% 2.0% 4.0% 6.0% 8.0% 10.0% 12.0% 14.0% 16.0% 18.0%

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.

Survey Question 2 Responses (Scale 0-50%)

Unsatisfactory

Not Good

Good
Survey Question 2 Responses (Scale 0-50%)

Unsatisfactory

Not Good

Good

Very Good

Excellent

0.0% 5.0% 10.0%15.0%20.0%25.0%30.0%35.0%40.0%45.0%50.0%


Return to Contents
rvey Question 1 Responses
3.0%
4.9%
24.4%
41.5%
26.2%
100.0%
rvey Question 2 Responses
2.9%
4.0%
11.0%
16.0%
12.0%
45.9%
The Date-Based Category Chart Axis
If 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/2003
spaced 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
Sales (Thousands)
Equally-spaced Dates Supplied by Excel

03
/ 20
7
/ 2 03
10 /20
5
/ 2 03
10 /20
3
/ 2 03
10 /20
1
/ 2 03
10 /20
9
/ 1 03
10 /20
7
/ 1 03
10 /20
5
/ 1 03
10 /20
3
/ 1 03
10 /20
1
/1 0 3
10 /20
/9 3
10 00
/2
/7 3
10 00
/2 $0.0 $1.0 $2.0 $3.0 $4.0 $5.0 $6.0 $7.0
/5
10

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".

Sales (Thousands)

10/28/2003
Dates From the Data Only

10/24/2003

10/23/2003

10/18/2003

10/12/2003

10/7/2003
10/24/2003

Dates From the Data Onl


10/23/2003

10/18/2003

10/12/2003

10/7/2003

10/5/2003

$0.0 $1.0 $2.0 $3.0 $4.0 $5.0 $6.0 $7.0


Sales (Thousands) Return to Contents
$5.3
$4.5
$6.6
$5.8
$3.2
$5.1
$4.8
Using Multiple Category Labels
Excel can recognize and use multiple rows or columns of category
values in a single chart.

Excel's Interpretation of the Data to Chart Month


Contacts
25

20

15

10

0
China Japan Croatia Russia Canada Mexico
Far East Eastern Europe West

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.

Multiple Category Labels Reinterpreted to include Months

25

20
Number of Contacts Made

15

10

0
10 11 10 11 10 11
China Japan Croatia Russia Canada Mexico
Far East Eastern Europe West
Number of Conta
10

0
10 11 10 11 10 11
China Japan Croatia Russia Canada Mexico
Far East Eastern Europe West
Category Labels
Data to Chart
Region Countries Month Contacts Return to Contents
Far East China 10 15
Japan 11 16
Eastern Europe Croatia 10 12
Russia 11 10
West Canada 10 18
Mexico 11 23
Controlling Chart Tick Mark Labels Data to Chart
With some charts you may want to override Excel's -5
standard positioning of tick mark labels -3
-1
3
Standard Tick Mark Label Position
5
Tick Mark Position
8
10

0
1 2 3 4 5 6
-2

-4

-6

Use the "Format Axis" dialog and the "Patterns" tab to


control tick mark label positioning on a chart.

Tick Mark Labels Specified "Low"

10

-2

-4

-6
1 2 3 4 5 6
-2

-4

-6
1 2 3 4 5 6

Tick Mark Labels Specified "High"

1 2 3 4 5 6
10

-2

-4

-6
Return to Contents
Labeling XY and Bubble Chart Data Points
Excel 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 also
provides 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.

Netsuke Demand by Price and Model


- as XY (Scatter) Plot -
20

16
15
Demand

12 12
10
8 8

5
4

0
$20 $25 $30 $35 $40 $45
Price

* 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
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 contains the
data labels should not be separated from the column that contains the x values. The
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 here):

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.Text = _
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 AttachLabelsToPoints
and then click Run to run the macro.
The macro automatically associates the labels with the data points on the chart.
Bubble Size**
Netsuke Price Demand Availability Return to Contents
Kirin $22 8 3
Badger $38 12 5
Foo Dog $32 10 4
Bean Thrower $42 5 1
Mirror Polisher $28 15 8

Netsuke Demand by Price, Model, & Availability


- as Bubble Chart -
16

12
Demand

8
5

4
$45 $15 $20 $25 $30 $35 $40 $45
Price

** 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.

ubble Chart.
that contains the
e x values. The

nvironment.

& paste from here):

",") - 1)

sDataLabel = _

ataLabel.Text = _
hLabelsToPoints,

nts on the chart.


Kirin Badger Foo Dog Mirror Polisher
Bean Thrower
3-D Chart Basics
Excel 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 2001
for selection. 2002

View 2: The "frame view" (


View 1: A standard 3-D column chart. Select the chart "Corners"

Dogs Registered with the AKC by Breed

6,000

4,500
Labrador
Corgi
Bedlington
3,000

1,500

-
2000 2001 2002
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 Options" dialog

Dogs Registered with the AKC by Breed

6,000

4,500

3,000

1,500
Bedlington

- Corgi

2000
2001 Labrador
2002

View 6: The data series modified so all data is visible; the chart rotated. The "Format Data Series" d

Dogs Registered with the AKC by Breed

6,000

4,500

3,000

1,500

Labrador

Corgi

2002
Bedlington
2001
2000
Corgi

2002
Bedlington
2001
2000
Chart Data Return to Contents
Labrador Corgi Bedlington
2,030 524 82
4,325 638 104
5,112 929 203

View 2: The "frame view" (w/CONTROL depressed to show shapes).


Select the chart "Corners" element and use this view to control perspective. View 3: The chart with perspective altered by dragging

Dogs Registered with the AKC by Bree

6,000

4,500

3,000

1,500

2000 2001 200


The "Chart Options" dialog "Axes" tab with all 3 axes selected. View 5: An incomprehensible 3-D view of the data.

Dogs Registered with the AKC by B

6,000
4,500
3,000
1,500
-
2000 B

2001 Corgi

2002 Labrador

The "Format Data Series" dialog with its "Series Order" tab.
ective altered by dragging the Corners element.

with the AKC by Breed

Labrador
Corgi
Bedlington

2001 2002
Use the "Chart Options" "3-D View" dialog and its Default
3-D view of the data. button to return the chart to a standard perspective.

ed with the AKC by Breed

Bedlington

1 Corgi

2002 Labrador

Das könnte Ihnen auch gefallen