cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Overview Page - New Analytical Annotations - Any examples out there?

MattHarding
Active Contributor

Hi All,

Quite some time back (1.32 UI5 version), I created a demo for the Fiori Overview Page and it had a nice Donut chart on it; but since then the analytical card config and associated annotations have changed (though the old ones still work).

While I've read through the doco, and believe I've created the right annotations, measure and dimension; I can't seem to get the Donut chart to display using the new version (in WebIDE version 1.40).

Anyone have an example using the new card "sap.ovp.cards.charts.analytical" template as opposed to the "sap.ovp.cards.charts.donut" template to display a donut graph?

Thanks,

Matt

Accepted Solutions (1)

Accepted Solutions (1)

MattHarding
Active Contributor

Thanks to Bernhard Siewert and Stefan Engelhardt last week at SAP TechEd, I was able to get this working now (the November update to WebIDE may have also had something to do with this).

In short, just needed to create the Chart annotation (as expected) - set the Measures and Dimensions; then create both the associated ChartMeasureAttributeType (Axis1 role pointing at the DataPoint annotation) and ChartDimensionAttributeType (category role). Then it worked (minimal version shown below for a Donut):

<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
	<edmx:Reference Uri="/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/components/factsheet/vocabularies/UI.xml">
		<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
	</edmx:Reference>
	<edmx:Reference Uri="/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/components/factsheet/vocabularies/Communication.xml">
		<edmx:Include Alias="vCard" Namespace="com.sap.vocabularies.Communication.v1"/>
	</edmx:Reference>
	<edmx:Reference Uri="/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/components/factsheet/vocabularies/Common.xml">
		<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/vocabularies/Org.OData.Core.V1.xml">
		<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs01/vocabularies/Org.OData.Measures.V1.xml">
		<edmx:Include Alias="CQP" Namespace="Org.OData.Measures.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs01/vocabularies/Org.OData.Capabilities.V1.xml">
		<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
	</edmx:Reference>
	<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/vocabularies/Org.OData.Aggregation.V1.xml">
		<edmx:Include Alias="Aggregation" Namespace="Org.OData.Aggregation.V1"/>
	</edmx:Reference>
	<edmx:DataServices>
		<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm">
			<Annotations Target="test.odata.SSI2sType">
				<Annotation Term="UI.DataPoint" Qualifier="Duration">
					<Record Type="UI.DataPointType">
						<PropertyValue Property="Title" String="{@i18n>@DURATION}"/>
						<PropertyValue Property="Value" Path="Duration"/>
					</Record>
				</Annotation>
				<Annotation Term="UI.Chart" Qualifier="chart">
					<Record Type="UI.ChartDefinitionType">
						<PropertyValue Property="Title" String="{@i18n>@TEST}"/>
						<PropertyValue Property="Description" String="{@i18n>@TEST}"/>
						<PropertyValue Property="ChartType" EnumMember="UI.ChartType/Donut"/>
						<PropertyValue Property="Measures">
							<Collection>
								<PropertyPath>Duration</PropertyPath>
								<PropertyPath>Counter</PropertyPath>
							</Collection>
						</PropertyValue>
						<PropertyValue Property="MeasureAttributes">
							<Collection>
								<Record Type="UI.ChartMeasureAttributeType">
									<PropertyValue Property="Measure" PropertyPath="Duration"/>
									<PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis1"/>
									<PropertyValue Property="DataPoint" AnnotationPath="@UI.DataPoint#Duration"/>
								</Record>
							</Collection>
						</PropertyValue>
						<PropertyValue Property="Dimensions">
							<Collection>
								<PropertyPath>RECORDED_BY</PropertyPath>
							</Collection>
						</PropertyValue>
						<PropertyValue Property="DimensionAttributes">
							<Collection>
								<Record Type="UI.ChartDimensionAttributeType">
									<PropertyValue Property="Dimension" PropertyPath="RECORDED_BY"/>
									<PropertyValue Property="Role" EnumMember="UI.ChartDimensionRoleType/Category"/>
								</Record>
							</Collection>
						</PropertyValue>
						<PropertyValue Property="Actions">
							<Collection/>
						</PropertyValue>
					</Record>
				</Annotation>
				<Annotation Term="UI.Identification" Qualifier="chart">
					<Collection/>
				</Annotation>
			</Annotations>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>

Answers (4)

Answers (4)

Hi Matt,

here is what did the job for me: i created a new entity type containing only those two attribues i needed for my donut chart: one being a string, the other one a float value.

Annotations for the donut chart:

	<Annotations Target="SERVICE_SRV.Priorities"> 
					<Annotation Term="UI.Chart" Qualifier="prioChart">
					<Record Type="UI.ChartDefinitionType">
						<PropertyValue Property="MeasureAttributes">
							<Collection>
								<Record Type="UI.ChartMeasureAttributeType">
									<PropertyValue Property="Measure" PropertyPath="Amount"/>
								</Record>
							</Collection>
						</PropertyValue>
						
						<PropertyValue Property="DimensionAttributes"> 
							<Collection>
								<Record Type="UI.ChartDimensionAttributeType">
									<PropertyValue Property="Dimension" PropertyPath="Name"/>
								</Record>
							</Collection>
						</PropertyValue>
					</Record>
				</Annotation>
			</Annotations>
MattHarding
Active Contributor
0 Kudos

Thanks for the example Tobias however the above looks like you've used the older version template sap.ovp.cards.charts.donut since you don't have the annotation: <PropertyValue Property="ChartType" EnumMember="UI.ChartType/Donut"/> which I believe would be required if using the sap.ovp.cards.charts.analytical template (which is what WebIDE puts in if you add a analytical card now days).

Is that right (e.g. I have donut working fine using the old method like this)?

0 Kudos

Hi Experts,

I have a problem with SAP SEGW based OData Annotation creations. I have used - com.sap.vocabularies.UI.v1 vocabulary and I created annotation for Smart Chart, As highlighted bellow the Dimensions, DimensionAttributes were created as child to MessureAttributes - IS this correct? Please confirm . From the above post I could see these Annotations are created like siblings to each other.

My Smart chart is also not working, It fails with the following error,

Uncaught TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at j (RoleFitter.js?eval:6) at t (RoleFitter.js?eval:6) at Object.x [as fit] (RoleFitter.js?eval:6) at f.z._prepareFeeds (Chart.js?eval:6) at f.vizFrame (Chart.js?eval:6) at f.eval (Chart.js?eval:6) at Function.each (jquery-dbg.js:371) at f.z.onBeforeRendering (Chart.js?eval:6) at f.a._handleEvent (Element-dbg.js:301).

Please help.

Regards,

Karthik

0 Kudos

Hi,

I do this example but chart not display in analytical list page, page is waiting . Help me , please..

Regards,

Özlem.

former_member204167
Participant
0 Kudos

Hi Guys,

I have a slighty different problem with SmartChart Control. I used SEGW to add the annotations mentioned above (vocabulary based odata project):

As you can see the property "ChartType" was generated as "Column". I have chosen that value in the corresponding DDLB in SEGW. Nevertheless, the chart is not working because it expects "com.sap.vocabularies.UI.v1.ChartType/Column" instead of just "Column". When I add this term using code in the MPC_EXT class using "com.sap.vocabularies.UI.v1.ChartType/Column" the Smart Chart works fine. Does anybody know why it doesn't work with Standard code?

Regards

Tobias

MattHarding
Active Contributor
0 Kudos

Sorry Tobias - I could never get vocabulary SEGW working the way I needed it - Figured it was based on a version of annotations that would not keep up with the changes required by OVP so it's just the annotation editor in WebIDE, or possibly CDS annotated views you're stuck with...

Cheers,

Matt

former_member204167
Participant
0 Kudos

Hi Matt,

the funny thing is that I got it working when adding the annotation in the code in MPC_EXT class. I just think this is not the way it should work. When SAP offers a vocabulary builder in SEGW I would expect that the result works with their smart controls. I just don't know why vocabulary builder does not add the "com.sap.vocabularies.UI.v1.ChartType" where its needed...

In your example it's actually "<PropertyValue Property="ChartType" EnumMember="UI.ChartType/Donut"/>" whereby "UI" is the alias for "com.sap.vocabularies.UI.v1". Really strange....

Regards

Tobias