<core:FragmentDefinition xmlns="sap.suite.ui.microchart" 
	xmlns:core="sap.ui.core" 
	xmlns:m="sap.m"
	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',
	ID: 'sap/fe/macros/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:with path="chartAnnotation>Measures/0" helper="MICROCHART.getMeasureAttributeForMeasure" var="MeasureAttribute">
		<template:with path="MeasureAttribute>DataPoint/$AnnotationPath/" var="DataPoint">
			<template:if test="{= ${DataPoint>Value} &amp;&amp; MICROCHART.isNotAlwaysHidden('Column', ${DataPoint>Value}, undefined, ${DataPoint>Value/$Path@com.sap.vocabularies.UI.v1.Hidden}) &amp;&amp; ${chartAnnotation>Dimensions/0/} }">
				<template:then>
					<template:with path="DataPoint>Value/$Path" helper="MODEL.resolve$Path" var="Measure">
						<template:with path="chartAnnotation>Dimensions/0/" var="Dimension">
							<oDataV4MicroChart:MicroChartContainer
								id="{= ${this>id} ? ID.generate([${this>id}, 'mCC']) : undefined }"
								renderLabels="{= ${this>renderLabels} !== 'false' ? true : false }"
								chartTitle="{= ${this>title} || ${chartAnnotation>Title}}"
								chartDescription="{= ${this>description} || ${chartAnnotation>Description}}"
								uomPath="{= ${this>renderLabels} !== 'false' &amp;&amp; (${Measure>@Org.OData.Measures.V1.ISOCurrency} || ${Measure>@Org.OData.Measures.V1.Unit}) &amp;&amp; (${Measure>@Org.OData.Measures.V1.ISOCurrency/$Path} || ${Measure>@Org.OData.Measures.V1.Unit/$Path}) }"
								measures="{DataPoint>Value/$Path}"
								dimension="{= ${Dimension>$PropertyPath@com.sap.vocabularies.Common.v1.Text} ? ${Dimension>$PropertyPath@com.sap.vocabularies.Common.v1.Text/$Path} : ${Dimension>$PropertyPath} }"
								measurePrecision="{= ${DataPoint>Value/$Path/$Precision} ? ${DataPoint>Value/$Path/$Precision} : undefined }"
								measureScale="{= (${DataPoint>ValueFormat} &amp;&amp; ${DataPoint>ValueFormat/NumberOfFractionalDigits}) ?  ${DataPoint>ValueFormat/NumberOfFractionalDigits} : ${DataPoint>Value/$Path/$Scale} ? ${DataPoint>Value/$Path/$Scale} : 1 }"
								dimensionPrecision="{= ${Dimension>$PropertyPath/$Precision} ? ${Dimension>$PropertyPath/$Precision} : undefined }"
								dataPointQualifiers="{= ${DataPoint>./@sapui.name}.indexOf('com.sap.vocabularies.UI.v1.DataPoint') === -1 ? undefined : (${DataPoint>./@sapui.name}.indexOf('#') > -1 ? ${DataPoint>./@sapui.name}.split('#')[1] : '') }"
								binding="{= ${this>groupId} ? ('{path:\'\', parameters : { $$groupId: \'' + ${this>groupId} + '\'} }') : undefined }">
								<ColumnMicroChart columns="{= '{path:\'' + (${collection>$kind} === 'EntitySet' ? '/' : '') + ${collection>@sapui.name} + '\', parameters : {' + MICROCHART.getSelectParameters('', ${DataPoint>CriticalityCalculation}, (${DataPoint>Criticality} ? ${DataPoint>Criticality/$Path} : ''), ((${Measure>@Org.OData.Measures.V1.ISOCurrency} || ${Measure>@Org.OData.Measures.V1.Unit}) ? (${Measure>@Org.OData.Measures.V1.ISOCurrency/$Path} || ${Measure>@Org.OData.Measures.V1.Unit/$Path}) : ''), (${Dimension>$PropertyPath@com.sap.vocabularies.Common.v1.Text} ? ${Dimension>$PropertyPath@com.sap.vocabularies.Common.v1.Text/$Path} : ${Dimension>$PropertyPath})) + '} }' }">
									<columns>
										<template:if test="{= ${DataPoint>Criticality} || (!${DataPoint>Criticality} &amp;&amp; !${DataPoint>CriticalityCalculation}) }">
											<template:then>
												<ColumnMicroChartData value="{path:'DataPoint>Value@@.MODEL.value', type:'sap.ui.model.odata.type.Decimal'}" color="{= ${DataPoint>Criticality} ? MICROCHART.getCriticalityBinding(${DataPoint>}) : undefined }"/>
											</template:then>
											<template:else>
												<template:with path="DataPoint>CriticalityCalculation" var="CriticalityCalculation">
													<template:with path="DataPoint>CriticalityCalculation/ImprovementDirection/$EnumMember" var="Direction">
														<ColumnMicroChartData value="{path:'DataPoint>Value@@.MODEL.value', type:'sap.ui.model.odata.type.Decimal'}" color="{= MICROCHART.getCriticalityCalculationBinding(${Direction>},
														${DataPoint>Value@@.MODEL.value},
														${CriticalityCalculation>DeviationRangeLowValue@@MODEL.format},
														${CriticalityCalculation>ToleranceRangeLowValue@@MODEL.format},
														${CriticalityCalculation>AcceptanceRangeLowValue@@MODEL.format},
														${CriticalityCalculation>AcceptanceRangeHighValue@@MODEL.format},
														${CriticalityCalculation>ToleranceRangeHighValue@@MODEL.format},
														${CriticalityCalculation>DeviationRangeHighValue@@MODEL.format}) }"/>
													</template:with>
												</template:with>
											</template:else>
										</template:if>
									</columns>
									<template:if test="{= ${this>renderLabels} !== 'false' }">
										<leftBottomLabel>
											<ColumnMicroChartLabel/>
										</leftBottomLabel>
										<leftTopLabel>
											<ColumnMicroChartLabel/>
										</leftTopLabel>
										<rightBottomLabel>
											<ColumnMicroChartLabel/>
										</rightBottomLabel>
										<rightTopLabel>
											<ColumnMicroChartLabel/>
										</rightTopLabel>
									</template:if>
								</ColumnMicroChart>
							</oDataV4MicroChart:MicroChartContainer>
						</template:with>
					</template:with>
				</template:then>
				<template:elseif test="{= MICROCHART.logWarning('Column', { DataPoint_Value : ${DataPoint>Value}, Dimension : ${chartAnnotation>Dimensions/0/$PropertyPath} }) }">
				</template:elseif>
			</template:if>
		</template:with>
	</template:with>

</core:FragmentDefinition>
