Creating a dynamic legend

复杂性:入门级 数据要求:随软件安装 数据路径: C:\program Files\ArcGIS\Desktop10.0\TemplateData

The graphic table element can be used to create dynamic surround elements such as a legend. The dynamic legend is updated based on the data frame's visual extent whether the legend is used in an MPS-Atlas map series or within a single .mxd file.

Adding cartographic data

Before you can create the legend, you need to add the data to the map. In this walkthrough, you are using the USA dataset, which is in a template database that is included with the ArcGIS install.

步骤:
  1. Click the Add Data button 添加数据 on the Standard toolbar.

    The Add Data dialog box appears.

  2. Browse to C:\Program Files\ArcGIS\Desktop10.0\Bin\TemplateData.
    注意注意:

    The data used for this example is located at C:\Program Files\ArcGIS\Desktop10.0\Bin\TemplateData.gdb by default for a standard installation.

  3. Add all the feature classes within the USA feature dataset to the data frame except the states feature class.
  4. Once all the feature classes are added to ArcMap, organize the layers in the following order by clicking and dragging them to the appropriate location:
    • U.S. Cities
    • U.S. Rivers (Generalized)
    • Country boundary, international border and coastline, for the United States
    • U.S. National Transportation Atlas Interstate Highways
    • Internal state boundaries of the United States
    • U.S. Lakes (Generalized)
    • U.S. Counties (Generalized)
    • Countries/islands neighboring the US

Symbolizing the U.S. Cities layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the U.S. Cities layer from the USA feature dataset.

步骤:
  1. Right-click the U.S. Cities layer in the table of contents and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane.
  4. In the list that appears, click Unique values, many fields.
  5. Click the first Value Fields drop-down arrow and choose TYPE.
  6. Click the second Value Fields drop-down arrow and choose CAPITAL.
  7. Uncheck the check box under the Symbol column.
  8. Click Add Values.

    The Add Values dialog box appears.

    Add Values dialog box
  9. Click Complete List.

    The list expands to display all values.

  10. Select values to add by pressing and holding the CTRL key and clicking the following:
    • city, N
    • city, Y
    • town, N
    注意注意:

    City, N represents noncapital cities; city, Y represents capital cities; and town, N represents noncapital towns.

  11. Click OK.

    The Layer Properties dialog box appears.

  12. Double-click the symbol for city, N.

    The Symbol Selector dialog box appears.

  13. Click the symbol for Circle 1.
  14. Click or type 10 in the Size text box.
  15. Click OK.

    The Layer Properties dialog box appears.

  16. Repeat steps 12–15 for the town, N symbol, but click or type 8 in the Size text box.
  17. Double-click the symbol for city, Y.

    The Symbol Selector dialog box appears.

  18. Click Edit Symbol.

    The Symbol Property Editor dialog box appears.

  19. Click the Type drop-down arrow and choose Character Marker Symbol.
  20. Click the Font drop-down arrow and choose ESRI Cartography.
  21. Type 241 in the Unicode text box.
  22. Type or choose 12 in the Size text box.
  23. Click OK.

    The Symbol Selector dialog box appears.

  24. Click OK.

    The Layer Properties dialog box appears.

  25. Click city, N in the Label column and rename it City.
  26. Click city, Y in the Label column and rename it Capital.
  27. Click town, N in the Label column and rename it Town.
  28. Click one of the values to activate the sort arrows on the right and use them to arrange the values in the following order:
    • Capital
    • City
    • Town
  29. Click OK.

Symbolizing the U.S. Rivers (Generalized) layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the U.S. Rivers (Generalized) layer from the USA feature dataset.

步骤:
  1. Right-click the U.S. Rivers (Generalized) layer in the table of contents and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box in the Symbol column.
  5. If necessary, click the Value Field drop-down arrow and choose NAME.
  6. Click Add All Values.
  7. Select all by holding down the SHIFT key and selecting all the values.
  8. Right-click the selected values and choose Group Values.
  9. Double-click the symbol in the Symbol column.

    The Symbol Selector dialog box appears.

  10. Click the symbol River.
    提示提示:

    It will be a narrow blue line in the first column.

  11. Click OK.

    The Layer Properties dialog box appears.

  12. Click the group values name in the Label column and rename it Rivers.
  13. Click OK.

Symbolizing the Country boundary, international border and coastline, for the United States layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the Country boundary, international border and coastline, for the United States layer from the USA feature dataset.

步骤:
  1. Right-click the Country boundary, international border and coastline, for the United States layer in the table of contents and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose TYPE.
  6. Click Add All Values.
  7. Hold down the CTRL key and click to select Hawaii, Lake, and Ocean.
  8. Right-click the selected values and choose Group Values.
  9. Double-click the symbol for the grouped values under the Symbol column.

    The Symbol Selector dialog box appears.

  10. Scroll until you find the symbol for Coastline and click on it to select it.
  11. Click OK.

    The Layer Properties dialog box appears.

  12. Double-click the symbol for Land.

    The Symbol Selector dialog box appears.

  13. Click the symbol for Boundary, National.
  14. Click OK.

    The Layer Properties dialog box appears.

  15. Click Hawaii; Lake; Ocean under the Label column and rename it Coastline.
  16. Click Land under the Layer column and rename it International Boundaries.
  17. Click OK.

Symbolizing the U.S. National Transportation Atlas Interstate Highways layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the U.S. National Transportation Atlas Interstate Highways layer from the USA feature dataset.

步骤:
  1. Right-click the U.S. National Transportation Atlas Interstate Highways layer in the table of contents and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose ROUTE_NUM.
  6. Click Add All Values.
  7. Select all by holding down the SHIFT key and selecting all the values.
  8. Right-click the selected values and choose Group Values.
  9. Double-click the symbol in the Symbol column.

    The Symbol Selector dialog box appears.

  10. Click the symbol for Freeway.
  11. Click OK.

    The Layer Properties dialog box appears.

  12. Click the grouped values name in the Label column and rename it Interstate Highways.
  13. Click OK.

Symbolizing the Internal state boundaries of the United States layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the Internal state boundaries of the United States layer from the USA feature dataset.

步骤:
  1. Right-click the Internal state boundaries of the United States layer and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose TYPE.
  6. Click Add All Values.
  7. Double-click the symbol for State Bnd.

    The Symbol Selector dialog box appears.

  8. Click the symbol for State Bnd.
  9. Click OK.
  10. The Layer Properties dialog box appears.
  11. Click State Bnd under the Label column and rename it State Boundaries.
  12. Click OK.

Symbolizing the U.S. Lakes (Generalized) layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the U.S. Lakes (Generalized) layer from the USA feature dataset.

步骤:
  1. Right-click the U.S. Lakes (Generalized) layer and click Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose NAME.
  6. Click Add All Values.
  7. Select all by holding down the SHIFT key and selecting all the values.
  8. Right-click the selected values and choose Group Values.
  9. Double-click the symbol for the group values under the Symbol column.

    The Symbol Selector dialog box appears.

  10. Click the symbol for Lake.
  11. Click OK.

    The Layer Properties dialog box appears.

  12. Click the grouped values name under the Label column and rename it Lake.
  13. Click OK.

Symbolizing the U.S. Counties (Generalized) layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the U.S. Counties (Generalized)layer from the USA feature dataset.

步骤:
  1. Right-click the U.S. Counties (Generalized) layer and choose Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose NAME.
  6. Click Add All Values.

    The following ArcMap warning appears:

    Warning message
  7. Click Yes.
  8. Select all by holding down the SHIFT key and selecting all the values.
  9. Right-click the selected values and choose Group Values.
  10. Double-click the symbol for the grouped values under the Symbol column.

    The Symbol Selector dialog box appears.

  11. Click Edit Symbol.

    The Symbol Property Editor dialog box appears.

  12. Click Outline.

    The Symbol Selector dialog box appears.

  13. Click the symbol for Boundary, City.
  14. Click OK.

    The Symbol Property Editor dialog box appears.

  15. Click the Color drop-down arrow and choose Apple Dust.
    提示提示:

    Look for Apple Dust in two columns of green in the lower portion of the color picker.

  16. Click OK.

    The Symbol Selector dialog box appears.

  17. Click OK.

    The Layer Properties dialog box appears.

  18. Click the grouped values name under the Label column and rename it Counties.
  19. Click OK.

Symbolizing the Countries/islands neighboring the US layer

The dynamic legend includes symbols for each of the features. In this part of the walkthrough, you are going to define symbols for the Countries/islands neighboring the US layer from the USA feature dataset.

步骤:
  1. Right-click Countries/islands neighboring the US layer and choose Properties.

    The Layer Properties dialog box appears.

  2. Click the Symbology tab.
  3. Click the Categories heading in the left-hand pane and choose Unique values.
  4. Uncheck the check box under the Symbol column.
  5. Click the Value Field drop-down arrow and choose CNTRY_NAME.
  6. Click Add All Values.
  7. Select all by pressing and holding the SHIFT key and selecting all the values.
  8. Right-click the selected values and choose Group Values.
  9. Double-click the symbol for the grouped values under the Symbol column.

    The Symbol Selector dialog box appears.

  10. Click the Fill Color drop-down arrow and choose Gray 10%.
  11. Click the Outline Color drop-down arrow and choose No Color.
  12. Click OK.

    The Layer Properties dialog box appears.

  13. Click the grouped values name under the Label column and rename it International Countries.
  14. Click OK.

Creating the legend for a map series

After all the layers that are going to be part of the legend have been symbolized, a map series needs to be created based on the counties within California. The graphic table element that is going to serve as the base for the legend also needs to be created.

步骤:
  1. For this example, create a map series using the counties within California.
  2. See About the map series creation process for complete instructions about creating a map series.
  3. Once your map series is created, on the main menu, click View > Layout View.
  4. Right-click Sacramento in the map series and click Set Current Map Sheet.
  5. On the main menu, click Insert > Graphic Table Element.

    The New Table dialog box appears.

  6. Click to choose Item to Row in the Available formats list.
  7. Click Wizard.

    The Set Table Format dialog box appears.

    Set Table Format dialog box
  8. Click the Width drop-down arrow and choose Expand cells.
  9. Click the Height drop-down arrow and choose Expand cells.
  10. Click Next.

    The Selecting table datasources dialog box appears.

    Selecting table datasources dialog box
  11. Select all the data sources from the list by holding down the SHIFT key and selecting all the data sources.
  12. If necessary, check the Always keep table dynamically synchronized with data frame and Define Filters check boxes.
  13. Click Next.

    The Defining table fields dialog box appears.

    Defining table fields dialog box
  14. Check the Show Common Fields and Properties check box.
  15. In the Source Fields list, click Shape and click the > button to move the field to the Table Fields list.
  16. Under Source Properties, choose FEATURE_SYMBOL_LABEL and click the > button to move the field to the Table Fields list.
  17. Click Next.

    The Defining filters dialog box appears.

    Defining filters dialog box
  18. Click U.S. Cities in the Data sources list.
  19. Click Filter.

    The Data Filters dialog box appears.

    Data Filters dialog box
  20. Click the Visible Extent option in the list in the Base Selection area.
  21. Click Add Filter and choose Sorting Filter.

    The Sort Options dialog box appears.

    Sort Options dialog box
  22. Click Add Table Fields.

    The Table Fields Selector dialog box appears.

    Table Fields Selector dialog box
  23. Click Capital in the Name column.
  24. Click OK.

    The Sort Options dialog box appears.

  25. Click the Sort Order drop-down arrow and select Descending.
  26. Click OK.

    The Data Filters dialog box appears.

  27. Click OK.

    The Defining filters dialog box appears.

  28. Click U.S. Rivers (Generalized) in the Data sources list.
  29. Click Filter.

    The Data Filters dialog box appears.

  30. Click the Visible Extent option in the list in the Base Selection area.
  31. Click OK.
  32. Repeat steps 30 through 32 for the following data sources:
    • Country boundary, international border and countries
    • U.S. National Transportation Atlas Interstate Highways
    • Internal state boundaries of the United States
    • U.S. Lakes (Generalized)
    • U.S. Counties (Generalized)
    • Countries/islands neighboring the US
  33. Click Data Items.

    The Data Items dialog box appears.

    Data Items dialog box
  34. Click Operations.

    The Operations Order dialog box appears.

    Operations Order dialog box
  35. In the Available Operations list, click Unique and Removing Empties and click the > button to move them to the Operations Order list.
  36. Click OK.

    The Data Items dialog box appears.

  37. Click Unique Options.
  38. The Unique options dialog box appears.
  39. Click Add Table Fields.

    The Table Fields Selector dialog box appears.

  40. Click Feature_Symbol_Label.
  41. Click OK.

    The Unique options dialog box appears.

  42. Click OK.

    The Data Items dialog box appears.

  43. Click OK.
  44. Click Finish.

    The New Table dialog box appears.

  45. Click OK.

    The following table appears in the map layout:

    Resulting table

Formatting the legend

After the basic table is created for the legend, you can refine its appearance. This part of the walkthrough guides you through the process of adding lines between the symbols and labels and modifying the table borders.

步骤:
  1. Right-click in the legend and choose Properties.

    The Table Properties dialog box appears.

  2. Click the Table Format tab.
  3. Click Table Design.

    The Item To Row Table Design dialog box appears.

  4. Click the X-units drop-down arrow and choose Centimeters.
  5. Click the Y-units drop-down arrow and select Centimeters.
  6. Hold down the SHIFT key and click to select cells h1, A and h1, B in the Table Layout area.
  7. Right-click cell h1, A, then click Delete > Rows.
  8. Repeat steps 6 and 7 for cells f1, A and f1, B.
  9. Hold down the SHIFT key and click to select cells c1, A and c1, B.
  10. Right-click cell c1, A and click Properties.

    The Properties dialog box appears.

  11. Click the Border tab.
  12. Click the symbol for None in the Presets area.
  13. Click OK.

    The Item To Row Table Design dialog box appears.

  14. Click the plus sign (+) next to c1, B in the Elements pane to expand the cell tree.
  15. Right-click FieldTextElement and choose Properties.

    The Properties dialog box appears.

  16. Click the Alignment tab.
  17. Click the Horizontal drop-down arrow and choose Right.
  18. Click OK.

    The Item To Row Table Design dialog box appears.

  19. Click the plus sign (+) next to c1, A in the Elements pane to expand the cell tree.
  20. Right-click FieldSymbolElement and choose Properties.

    The Properties dialog box appears.

  21. Click the Fill Dimensions tab.
  22. Click Rounded Rectangle in the Shape list.
  23. Click the Line Dimensions tab.
  24. Click Horizontal.
  25. Click OK.

    The Item To Row Table Design dialog box appears.

  26. Right-click c1, A in the Table Layout, then click Insert > Column Right.

    A new column is added between cells c1, A and c1, C.

  27. Click cell c1, B.
  28. Right-click cell c1, B in the Elements pane, then click Add Element > Line.

    The New line element dialog box appears.

  29. Click the Symbol tab.
  30. Click Change Symbol.

    The Symbol Selector dialog box appears.

  31. Scroll down and click the Dashed with 1 Dot symbol.
  32. Click Edit Symbol.

    The Symbol Property Editor dialog box appears.

  33. Click the Cartographic Line tab, if necessary.
  34. Click the dashed line in the Layers window.
  35. Click the Delete button 删除.
  36. Click the Template tab.
  37. Click and slide the light gray square to create a gap of three white squares.
  38. Click or type 1 in the Interval text box.
  39. Click the Units drop-down arrow and choose Points if necessary.
  40. Click OK.

    The Symbol Selector dialog box appears.

  41. Click OK.

    The New line element dialog box appears.

  42. Click the Flex Margins tab.
  43. Check the Left check box.
  44. Click the Cell drop-down arrows and set the cell to c1, A.
  45. Click the Position drop-down arrow and choose Right.
  46. Click the Element drop-down arrow and choose FieldSymbolElement.
  47. Check the Right check box.
  48. Click the Cell drop-down arrows and set the cell to c1, C.
  49. Click the Position drop-down arrow and choose Left.
  50. Click the Element drop-down arrow and choose FieldTextElement.
  51. Click the Margins tab.
  52. Type 0.1 in the Left and Right text boxes.
  53. Click the Alignment tab.
  54. Click the Vertical drop-down arrow and choose Bottom.
  55. Click OK.

    The Item To Row Table Design dialog box appears.

  56. Click OK.

    The Table Properties dialog box appears.

  57. Click OK.

    The resulting legend will be similar to the following:

    Legend table
  58. Switch between map sheets in the map series by right-clicking a map sheet and choosing Set Current Map Sheet to see the legend change dynamically.

10/2/2010