<core:FragmentDefinition
	xmlns="sap.suite.ui.microchart"
	xmlns:core="sap.ui.core"
	xmlns:oDataV4MicroChart="sap.fe.macros.microchart"
	xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
	template:require="{
		MODEL: 'sap/ui/model/odata/v4/AnnotationHelper',
		MICROCHART: 'sap/fe/macros/microchart/MicroChartHelper',
		CRIT: 'sap/fe/core/templating/CriticalityFormatters',
		UI: 'sap/fe/core/templating/UIFormatters',
		ID: 'sap/fe/core/helpers/StableIdHelper'
	}"
>
	<!-- MODEL.value is used instead MODEL.format because, MODEL.format adds type as Unit when Currency/Unit annotations exist and the control property expects decimal as type -->
	<template:if test="{= MICROCHART.shouldMicroChartRender('Comparison', ${DataPoint>}, ${DataPoint>Value/$Path@}, ${metaPath>})}">
		<template:then>
			<template:with path="DataPoint>Value/$Path" helper="MODEL.resolve$Path" var="Measure">
				<template:with path="metaPath>Dimensions/0/" var="Dimension">
					<template:with path="metaPath>Dimensions/0/$PropertyPath" helper="MODEL.resolve$Path" var="DimensionPath">
						<oDataV4MicroChart:MicroChartContainer
							id="{= ${this>id} ? ID.generate([${this>id}, 'ComparisonMicroChart']) : undefined }"
							showOnlyChart="{this>showOnlyChart}"
							chartTitle="{= ${this>title} || ${metaPath>Title}}"
							chartDescription="{= ${this>description} || ${metaPath>Description}}"
							uomPath="{= MICROCHART.getUOMPathForMicrochart(${this>showOnlyChart}, ${Measure>@}) }"
							dataPointQualifiers="{= MICROCHART.getDataPointQualifiersForMicroChart(${DataPoint>./@sapui.name}) }"
							binding="{= ${this>batchGroupId} ? ('{path:\'\', parameters : { $$groupId: \'' + ${this>batchGroupId} + '\'} }') : undefined }"
							onTitlePressed="{this>onTitlePressed}"
							navigationType="{this>navigationType}"
						>
							<template:if test="{= !${this>showOnlyChart} || (${this>showOnlyChart} !== 'true' ? true : false)}">
								<core:Fragment fragmentName="sap.fe.macros.microchart.fragments.MicroChartTitle" type="XML" />
							</template:if>
							<ComparisonMicroChart
								hideOnNoData="{this>hideOnNoData}"
								data="{= MICROCHART.getAggregationForMicrochart('Data', ${contextPath>}, ${DataPoint>}, ${contextPath>@sapui.name}, ${Dimension>}, ${Measure>@}) }"
								colorPalette="{= MICROCHART.getColorPaletteForMicroChart(${DataPoint>}) }"
								size="{this>size}"
								maxValue="{DataPoint>MaximumValue@@MODEL.value}"
								minValue="{DataPoint>MinimumValue@@MODEL.value}"
							>
								<data>
									<ComparisonMicroChartData
										value="{DataPoint>Value@@MODEL.value}"
										title="{= ${Dimension>$PropertyPath@com.sap.vocabularies.Common.v1.Text} ? ${DimensionPath>@com.sap.vocabularies.Common.v1.Text@@MODEL.format} : ${Dimension>@@MODEL.format} }"
										displayValue="{= MICROCHART.getDisplayValueForMicroChart(${DataPoint>}, ${DataPoint>Value/$Path@com.sap.vocabularies.Common.v1.Text}, ${DataPoint>Value/$Path@com.sap.vocabularies.Common.v1.Text/$Path/$}, ${DataPoint>Value/$Path/$}) }"
										color="{= CRIT.buildExpressionForCriticalityColorMicroChart(${DataPoint>@@UI.getDataModelObjectPath}) }"
									/>
								</data>
							</ComparisonMicroChart>
						</oDataV4MicroChart:MicroChartContainer>
					</template:with>
				</template:with>
			</template:with>
		</template:then>
		<template:elseif
			test="{= MICROCHART.logWarning('Comparison', { DataPoint_Value : ${DataPoint>Value}, Dimension : ${metaPath>Dimensions/0/$PropertyPath} }) }"
		/>
	</template:if>
</core:FragmentDefinition>
