Creating Charts

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • List the annotations for defining charts in object pages

Charts

OData Service with Analytic Function

A smart chart control sends an aggregate request to the back end service by sending the $select OData parameter.

A normal entity set will return all records only with fields in $select, but an analytic entity set will return an aggregated result considering the fields in $select.

To define an analytic entity set, add a @defaultAggregation annotation to fields you need to aggregate (normally are amount or quantity fields).

The generated entity set has the following differences compared to a normal entity set:

  • A generated ID field is used as primary key instead of key of the CDS view.
  • When accessed by $select, the engine tries to determine if the fields in $select are attributes or measures according to @defaultAggregation, then calculate the aggregated measures grouped by attributes in $select.

A typical scenario is to define the CDS view for the list report and the object page as a normal entity set and define that the CDS view represents detailed level entry as an analytic entity set. Then, create a 1 to * association from master level entity to detail level entity. Then, the user can get summarized detail data from the object page.

Note
Another method of creating an analytic OData service is Analytic Query, for detailed information of Analytic Query, refer to course S4H410.

Add @UI.Chart Annotation

A @UI.Chart annotation is used to define a smart chart. In the chartType property, you can specify the type of chart. You need to specify measures and dimensions.

The @UI.Chart term is also available in local annotation. Normally a @UI.Chart is defined in a analytic CDS view.

Adding a Reference Facet

A reference facet should be created as a direct child of @UI.facet with type #CHART_REFERENCE and reference to @UI.Chart annotation through an association.

Micro Bullet Chart

A Micro Bullet chart is used to evaluate a key figure by entering its actual value, minimum value, max value, forecast value, and target value together, and then showing the criticality by the color. It's useful to get insight among target, plan, and actual, and widely used in analytic scenarios.

The bullet chart can be used as a header facet in the object page.

Example of a Bullet Chart

Like smart charts, the creation of micro chart involves @UI.facet and @UI.chart.

In contrast to smart charts, a micro chart has more detailed insight to a point of data. So that a @UI.dataPoint is involved in the creation of a micro chart as @UI.chart does not contain all of the detailed information for a point of data. The evaluated value should be the only member in the @UI.chart.measure and it must link to a @UI.datapoint annotation through measureAttributes. All other values (max,min,target,forecast … ) are assigned in @UI.dataPoint.

Save progress to your learning plan by logging in or creating an account