About data templates
Data templates visually represent query result set data in layout objects.
Data templates are used to create and control the visual representation of query result set data within layout objects. Anything that you place within a data template is replicated for each row of data that is returned from the query associated with the template. For example, the template for a line chart can consist of a data symbol and a connecting line. Each row of query data will then be represented by its own data symbol and connecting line. With direct access to the data template, content developers have the ability to construct a wide variety of customized charts and layouts. For example, one could produce a floating quartile graph by setting the start and end points of each bar in the data template and adding horizontal line primitives that are set to the mean and 25th and 75th percentiles of the data column(s).
Data templates provide tremendous control over a layout's behavior. However, you can also use them to make minor modifications to your charts and layouts. The following paragraphs provide a number of typical modifications that you can make to your data templates.
Customizing data symbols and graphic objectsYou can customize the way query results are displayed in layout objects by editing the properties of the objects contained in their data templates. For example, you want to build an organization chart that displays the name of each member of a sales team in bold. By default, the text of the label objects that display each name is not bold. To display each name with bold text, you change the Bold property of the label object in the organization chart's data template folder to true. Now each member of the sales team's name will be displayed with bold text. You can also parameterize the display properties of data symbols and graphic objects. You want the names of sales team members who met their quotas to display as black text, and the names of sales team members who did not meet their quotas to display as red text. You change the Color property value of the label objects in the data template to a conditional expression. Now, when the organization chart is run, each name will display as either red or black depending on whether the sales team member met his or her quota.
Displaying multiple graphic objects for each data pointYou can display multiple objects for each data point by adding multiple objects to the data template folder of the layout object. Using the example of an organization chart again, you might want to add a column chart that shows sales team member's quarterly sales totals by their name. You open the data template folder in the editor window and add a parameterized column chart object so that it is positioned directly beneath the label object of the organization chart. Now when the organization chart is run, a column chart is displayed for each team member that shows their individual quarterly sales totals. Now when the organization chart is run, a column chart is displayed for each team member that shows their individual quarterly sales totals.
Displaying multiple query result sets in a single layout objectA data template is always associated with a single query. However, you can draw from as many columns as you wish when presenting the data in your data template. For example, you wish to chart three query columns and set the color or size of each data point, based on three other query columns, and so on.
A layout can have multiple data templates, each of which draws data from differing queries, running against the same or differing data sources. When you add multiple data templates to a layout, such as a line chart, all data points are presented within the same pair of axes, auto-scaled (if set) to the minimum and maximum data values across all queries/data templates. Finally, you can mix the visual representation in a given layout. For example, you can present one or more line chart traces within a column chart, each running from the same or differing data templates.