During this lab, you will create a data graphic item to represent a pie chart and then create two data graphics to test the data bar item.
Estimated time to complete this lab: 60 minutes
Before You Begin
To complete this lab, you will need:
-
Participants should have completed the Try This! Sections of this module before completing this lab.
-
Visio 2007 or higher installed and configured.
-
Lab files needed:
What You Will Learn
After completing this lab, you will be able to:
19.Exercise : Create a Pie Chart data graphic item Scenario
You need to include a pie chart in a data graphic, but the standard data bar items do not include a pie chart. You will have to create a new pie chart data bar data graphic item.
Tasks -
Create a new blank drawing.
-
A basic pie chart shape is needed. You don’t need to create one from scratch because we’ll start with a variation of an existing Visio Pie Chart shape and turn it into a data bar item. It has the basic pie chart features needed. Open the stencil from the Labs folder (from the Shapes window More Shapes > Open Stencil and then traverse to the Labs folder and open ScheduleBuilder.vss.
-
Drag the New Pie Chart shape to the page. Use the RMA commands to set Number of Slices and Slice Sizes.
This is a modified version of the Pie Chart shape from the Charts and Graphs stencil. It is limited to 5 sections. Enter a value for each slice. The value is “normalized” to be a percentage of the total of the five slices.
Note: The shape is “themed”. Browse through some of the subshapes of the group and look at the FillForegnd cells. They have Theme formulas that reference the different accent colors of the Theme.
-
Open the ShapeSheet for the Pie Chart group shape. Look at the User-defined section and the Shape Data section. Note that there are Shape Data cells to contain the values for each slice. There are User-defined cells that calculate normalized values for the cells. These User-defined cells are referenced from the group’s subshapes.
-
Turn this shape into a data bar data graphic item by editing the master in the Document Stencil. Add the User-defined cell User.msvCalloutType. Set its value to “Data Bar”. Close the Master editing window and save the changes.
-
Check if it worked. In the Data Graphics task pane create a new Data Graphic. Add a new graphic item of type Data Bar. The New Pie Chart shape should show as a new data bar option to choose from.
-
Now you need to set up the fields that are to be displayed on the data graphic by turning the existing shape data fields into data graphic fields. Edit the New Pie Chart master from the Document Stencil window. Open the ShapeSheet for the New Pie Chart group shape.
-
In the Shape Data section delete the row Prop.Slices. This will be driven from the data graphic, not by user choice.
-
Change the name of Prop.Pie1 to Prop.msvCalloutField and set the following column values:
Label=No Formula
Value=0
Invisible=True
-
Change the name of Prop.Pie2 to Prop.msvCalloutPropField2 and set the following column values:
Prompt=”Field”
Value=0
Invisible=True
-
Change the name of Prop.Pie3, Prop.Pie4, Prop.Pie5 to msvCalloutPropField3, msvCalloutPropField4, and msvCalloutPropField5 respectively. Set the Prompt, Value, and Invisible fields the same as msvCalloutPropField2.
-
Delete the Actions section from the ShapeSheet. This is no longer needed.
-
In the User-defined section delete the row User.Pies. This is no longer needed.
-
Close the master window and save the changes.
-
Check if it worked. In the Data Graphics task pane create a new Data Graphic. Choose a Data field. Any field will do for the moment so choose More Fields…>Geometry>Width. Set Displayed as: to be Data Bar. Select the New Pie Chart graphic item. The New Item dialog should look like the following. You should see Pie2 through Pie5 in the Details section and the values are displayed as [Not Used].
-
Make the new master graphic item hidden. You can create a macro for this or use the Immediate Window in VBA. From the Immediate Window type:
activedocument.Masters("New Pie Chart").Hidden=true
The master can still be seen from the Drawing Explorer window, but not from the Document Stencil.
20.Exercise 2: Test the New Pie Chart data graphic item Scenario
To test the new graphic item you will link a shape to a row in an external data set and then create a data graphic and apply it to the shape.
Tasks -
Choose Data > Link Data to Shapes and choose the file ScheduleBuilder.xls from the Labs folder. Specify the Sections worksheet in the Excel file. The Sections data will appear in the External Data window. Accept all defaults to finish the wizard.
-
Draw a rectangle on the page and link it to the first row of data. Note that a default data graphic is assigned to the shape.
-
Choose Data > Data Graphics > Create New Data Graphic . Add a New Item.
-
Set the Data Field to 9. This is the number of students in grade 9.
-
Set Displayed as to Data Bar and set the Style to New Pie Chart.
-
Set the following:
Pie2=10
Pie3=11
Pie4=12
Leave Pie5 unchanged.
-
Set the callout position of the data graphic item to Center and Middle.
-
Apply the data graphic to the shape. Does the data graphic appear the right size for the shape? By default it scales to the size of the shape.
-
From the Drawing Explorer window edit the New Pie Chart master. Open the ShapeSheet and set these formulas into the Width and Height cells.
Width=Guard(0.5 in*DropOnPageScale)
Height=Guard(Width)
-
Close the master editing window and save the changes.
-
The data graphic will not update on the shape automatically so apply the None data graphic and then reapply the new data graphic. It should now appear in a fixed size of 0.5 inches.
-
Rename this data graphic to “DG Pivot”
21.Exercise 3: Add a data bar to the Data Graphic that totals the 9th, 10th, 11th, and 12th grade slots for a class section. Scenario
Create a new data graphic based on “DG Pivot” and add a data bar item.
Tasks -
Create a duplicate of “DG Pivot”. Choose Data > Data Graphics. Right click the data graphic and choose Duplicate.
-
Rename the new data graphic “DG Section”.
-
Edit “DG Section”. Add a New Item.
-
Under Data Fields choose More Fields… and then Custom Formula. In the Custom formula text field enter ={9}+{10}+{11}+{12}
-
Set the Displayed as field to Data Bar and set the Style to Data Bar 3.
-
Set the callout position to Right – Bottom.
-
Set the Maximum value to 35.
-
Set the Label to “Total”. Close the Data Graphic dialog.
-
Draw a rectangle
-
Link it to a row of data
-
Apply the data graphic
-
You should see something similar to the image below.
-
Save the drawing. You will use the data graphics just created in the next module.
Share with your friends: |