Chart: Report Graph

The Chart element defines the graph that is displayed in the Summary section of the report. The chart can be represented as a pie chart or as a column or line graph. The chart data is based on the dataset for the report detail grid (the DataSource element) unless a DataSourceRule or Script is specified for the chart. Commonly, the chart represents the report body's data, grouped and counted by groupings (i.e. "value" is a count, grouped by the category and/or series).

Attributes available to define the chart are listed in this table:

Attribute

Usage

title

Name to display above the chart

type

Identifies the type of chart to display (pie, column, or line)

category

Defines the X axis in line or column graphs; defines the separate sections of a pie graph

value

Defines the Y axis in line or column graphs; defines the portion (fraction) of the pie that belongs to each section in a pie graph; often a count

series

Defines the separate columns or lines on line or column graphs; ignored for pie charts

groupBy

String value of column name (or CSV list of column names) to group data by for graphing counts

sortBy

List of sort columns for data; seldom used since groupBy can specify multiple fields in a CSV list

limit

Limits the number of records examined for the graph; seldom used, unless a similar limit was imposed on the report detail data, because the graph should generally represent all of the data in the report detail

script

Used to define a datasource for the chart other than the report detail data; script contains a <Source> element with BeanShell content

dataSourceRule

Used to define a datasource for the chart other than the report details data; contains a reference to a rule where the BeanShell has been encapsulated

nullSeries

Label to display if the series value (x-axis) is null (for example, a null certification action status means "Open" so that should be the label for the group of certifications whose action.status is null)

nullCategory

Label to display for data group when the category value is null

In most cases, the chart is created by selecting the value, category, and series fields from the object queried by the report detail datasource using the exact same filter criteria used by that datasource. The table below describes how the chart data is retrieved by default (when a dataSourceRule or Script are not specified for the chart).

Report Detail DataSource Type

Default Chart Query

Filter

DataSource's objectType object is queried using the queryOptions built from the DataSource Query, QueryScript, and QueryParameters elements

Java

Requires the DataSource class to have implemented the getBaseQueryOptions method; this method should return the QueryOptions used in the report detail query; also requires that the objectType is specified on the DataSource; retrieves the data for the chart from the objectType object using the QueryOptions returned by getBaseQueryOptions()

HQL

Uses the same query string employed by the report detail query, which specifies both the From and the Where clauses, to retrieve the chart's data

Standard Chart Examples

This example pie chart from the Uncorrelated Accounts Report examines the uncorrelated account data pulled from Links, groups it by application.id and counts the number of uncorrelated accounts on each application. The graph represents the number of uncorrelated accounts from each application (in this case, one uncorrelated account was found per application).

Copy
<Chart category="application.name" groupBy="application.id" title="rept_uncorrelated_ids_chart_title" type="pie" value="count(*)"/>

The Manager Access Review Report contains an example of a Column graph that shows the count of certification items that are open, approved, or revoked (reflected in the action.status attribute), separated by roles and additional entitlements if applicable (reflected in the type attribute).

Copy
<Chart category="type" groupBy="action.status,type" nullSeries="cert_action_open" series="action.status" title="rept_cert_chart_title" type="column" value="count(*)"/>

Chart Script and DataSourceRule

The script and dataSourceRule elements can provide the report writer more flexibility in creating charts based on any data. However, these are generally used only in rare cases in custom reports. The standard reports do not use a Script or DataSourceRule for their charts.

When either of these is used, the BeanShell within them is provided the following parameters:

DataSourceRule or Script Parameters

Contents/Purpose

context

A SailPoint Context for executing the search

args

The TaskDefinition Arguments map

report

The entire LiveReport report definition

baseHql

The from and where clause used in the report detail search if the report DataSource was an HQL datasource; null if DataSource type was not HQL

baseQueryOptions

The QueryOptions (specifying the "where" clause criteria) used in the report detail search if the report DataSource was a Filter datasource; null if Datasource type was not Filter

The code must return a list of maps (List<Map<String, Object>>) with each map representing the value, category, and series for each component of the chart. If there is no series, the "series" should be recorded as empty string ("") rather than null.

For example:

{[("value","23"), ("category","ADAM"),("series","")],

[("value","5"), ("category","Financials"),("series","")],

[("value","12"), ("category","PeopleSoft"),("series","")]}

The rule or script can add onto the existing criteria from the report detail's DataSource by modifying the baseHql or baseQueryOptions or it can build the chart data with completely independent criteria. The BeanShell is responsible for specifying the desired columns and search criteria, executing the database search to retrieve the data, formatting the data into the list of maps, and returning that list.