Show TOC

Smart Micro ChartLocate this document in the navigation structure

The sap.ui.comp.smartmicrochart.SmartMicroChart control is used to create different micro charts based on OData metadata.

Overview

The SmartMicroChart control analyses the metadata document of an OData service and renders a MicroChart control for a specified entitySet. If no annotations or metadata are provided, the chart will not be rendered.

According to the defined value in the chartType property of the UI.Chart annotation the corresponding MicroChart control is rendered. Currently, the following chart types are supported:

  • Area (sap.ui.comp.smartmicrochart.SmartAreaMicroChart will be created) based on the UI.ChartType Area and Line.

  • Bullet (sap.ui.comp.smartmicrochart.SmartBulletMicroChart will be created) based on UI.ChartType Bullet.

Note In case of a different UI.ChartType is provided than the mentioned above, the control does not render anything. The developer gets informed with a log statement.

The metadata should be annotated with the UI.Chart and the UI.DataPoint terms. Both terms need to annotate one and the same entityType (see also the entitySet property of the SmartMicroChart control in the ).

Details

Both SmartAreaMicroChart and SmartBulletMicroChart control need to handle the properties as follows:

  • DataPoint property of the Chart annotation should point to the DataPoint annotation. Example:

    <Property="DataPoint" AnnotationPath="@UI.DataPoint#BulletChartDataPoint">

    In this example, the BulletChartDataPoint is the qualifier of the DataPoint annotation.

  • Measures and Measure properties

    Measures property of the Chart annotation and Measure property of the MeasureAttributes property of the Chart annotation should point at the same property in the entityType (Revenue in the sample below). Example:

    <EntityType Name="ProductType" sap:label="Product Sales Data" sap:content-version="1">
    				<Key>
    					<PropertyRef Name="Product" />
    				</Key>
    				<Property Name="Product" Type="Edm.String" />
    				<Property Name="Revenue" Type="Edm.Decimal"/>
    				<Property Name="TargetRevenue" Type="Edm.Decimal"/>
    				<Property Name="ForecastRevenue" Type="Edm.Decimal"/>
    				<Property Name="Criticality" Type="Edm.String"/>
    				<Property Name="Currency" Type="Edm.String"/>
    				<Property Name="ChartTitle" Type="Edm.String"/>
    				<Property Name="ChartDescription" Type="Edm.String"/>
    			</EntityType>
    											
    						
    					
    <Annotations Target="BmcNamespace.ProductType" xmlns="http://docs.oasis-open.org/odata/ns/edm">
    				<Annotation Term="UI.Chart">
    					<Record>
    						<PropertyValue EnumMember="UI.ChartType/Bullet"
    							Property="ChartType" />
    						<PropertyValue Property="Title" Path="ChartTitle" />
    						<PropertyValue Property="Description" Path="ChartDescription" />
    						<PropertyValue Property="Measures">
    							<Collection>
    								<PropertyPath>Revenue</PropertyPath>
    							</Collection>
    						</PropertyValue>
    						<PropertyValue Property="MeasureAttributes">
    							<Collection>
    								<Record Type="UI.ChartMeasureAttributeType">
    									<PropertyValue Property="Measure" PropertyPath="Revenue" />
    									<PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis1" />
    									<PropertyValue Property="DataPoint" AnnotationPath="@UI.DataPoint#BulletChartDataPoint" />
    								</Record>
    							</Collection>
    						</PropertyValue>
    					</Record>
    				</Annotation>
    				<Annotation Term="UI.DataPoint" Qualifier="BulletChartDataPoint">
    					<Record>
    						<PropertyValue String="Product" Property="Title" />
    						<PropertyValue Path="Revenue" Property="Value" />
    						<PropertyValue Path="TargetRevenue" Property="TargetValue" />
    						<PropertyValue Path="ForecastRevenue" Property="ForecastValue" />
    						<PropertyValue Decimal="0" Property="MinimumValue" />
    						<PropertyValue Decimal="200" Property="MaximumValue" />
    						<PropertyValue Path="Criticality" Property="Criticality" />
    					</Record>
    				</Annotation>
    			</Annotations>
    
    
    
    Note The same entityType property should be used as a path for the Value property of the DataPoint annotation.