FME Version
Files
Introduction
The PowerPointStyler can create many of the chart types available within PowerPoint like: line, bar, column, pie, area, doughnut, and stacked. This tutorial is part four of six and will look at how to create a bar chart as well as a stacked bar chart.
Downloads
PowerpointWriter-4-Charts-Begin.fmwt Beginning workspace
PowerpointWriter-4-Charts-Bar-Complete.fmwt Completed Part 1 workspace
PowerpointWriter-4-Charts-StackedBar-Complete.fmwt Completed Part 2 workspace
Other_Cities_Vendors.xlsx Excel data for Part 2
Step-by-step Instructions
Part 1: Bar Graph - One Value
In part 1, we will create a bar graph using only one input value. We will be evaluating how many food trucks are in each district.
1. Open starting workspace.
This workspace continues on workspace from the previous tutorial or you can open the PowerPointWriter-4-Charts-Bar-Begin.fmwt workspace.
2. Calculate statistics
For this tutorial, we are going to create a basic bar graph to show the number of food vendors per district. To start off, let’s add a StatisticsCalculator transformer to the canvas and connect it to the Output port on the AttributeManager. In the parameters set the Group By to District. Then set the Attribute to District and enable Total Count.
3. Create a list
To create a chart in PowerPoint, the PowerPointStyler requires the input to be a list. Add a ListBuilder transformer to the canvas and connect it to the Summary output port on the StatisticsCalculator. In the parameters set Add to List to All Attributes.
4. Create the chart
Now add a PowerPointStyler transformer to the canvas and connect it to the ListBuilder that is connected to the StatisticsCalculator. In the parameters change the Slide Type to Chart and the Slide Subtype to Chart with Title. For the Title type in Food Vendors Per District. For Chart Parameters set the Chart Type to Bar and Label Data to Yes. We don’t need a legend for this chart type because each of the bars is already labeled.
Next, for Chart Data, set the Categories to _list{}.District. Then for Series Value set it to _list.{}.Count and set Series Name to Series 1. Finally, set the Slide Order to 13 and connect the PowerPointStyler to the PowerPoint Writer.
5. View output
Run the translation and inspect the output PowerPoint file.
Part 2: Stacked Bar Graph - Multiple Values
In part 2, we will create a stacked bar graph that uses multiple values. We will create a graph that counts the number of food trucks by their type in each of the surrounding cities.
1. Read in Excel File
Continuing in the same workspace from Part 1, or open up the PowerpointWriter-4-Charts-Bar-Complete.fmwt template workspace. We have acquired another Microsoft Excel file, this one contains all of the food trucks in the cities surrounding Vancouver and counts how many of each type are in each city.
Add another Microsoft Excel reader to the canvas and browse to the Other_City_Vendors.xlsx.
2. Create a List
To create the chart, we need to create lists. Add another ListBuilder to the canvas and connect it to the City Vendors feature type. In the parameters, select All Attributes for Add to List.
3. Create Chart
Add another PowerPointStyler to the canvas and connect it to the ListBuilder_2. In the parameters, set the Slide Type to Chart Slide, then set the Title to: Surrounding Cities Food Vendor Totals. Change the Chart Type to Bar Stacked and Label Data to No. Ensure Legend is enabled and set the Placement to Top-Right.
Now to set up the chart data, we will set the Categories to _list{}.A, which is the column name for all the cities.
To create the bars, we will set the Series Values to each of the cities listed in column A and for Series Name we will type in the name of the city for our legend. Set up the attributes using the following table:
Series Values |
Series Name |
_list{}.Burnaby |
Burnaby |
_list{}.North Vancouver |
North Vancouver |
_list{}.Richmond |
Richmond |
_list{}.Surrey |
Surrey |
4. Run the Translation and View the Output
Connect the PowerPointStyler_14 to the PowerPoint writer, then save and run the translation.
Open up the PowerPoint to view the results.
Save your workspace and continue on to the next tutorial where we will be adding maps to the presentation.
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.