I have a SAPUI5 VizFrame with a one DimensionDefinition, Currency, and two MeasureDefinition, Turnover and Cost. Cost should always have the same color (I used sapUiChartPaletteSequentialHue1). Turnover should have color sapUiChartPaletteSemanticBad if Cost is higher then Turnover, and color sapUiChartPaletteSemanticGood if Turnover is higher or equal to Cost.
This is the code in the view:
<viz:VizFrame xmlns="sap.viz" id="idDetailVizFrame" vizType='column' width="100%" height="100%" uiConfig="{applicationSet:'fiori'}">
<viz:dataset>
<vizData:FlattenedDataset data="{/DataSet}">
<vizData:dimensions>
<vizData:DimensionDefinition name="Currency" value="{Currency}"/>
</vizData:dimensions>
<vizData:measures>
<vizData:MeasureDefinition identity="idCost" name="{i18n>labelCost}" value="{Cost}" unit="{Currency}" />
<vizData:MeasureDefinition identity="idTurnover" name="{i18n>labelAccountBalance}" value="{Turnover}" unit="{Currency}" />
</vizData:measures>
</vizData:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<vizFeeds:FeedItem id='valueCost' uid="valueAxis" type="Measure" values='idCost'/>
<vizFeeds:FeedItem id='valueTurnover' uid="valueAxis" type="Measure" values='idTurnover'/>
<vizFeeds:FeedItem id='categoryAxisFeed' uid="categoryAxis" type="Dimension" values="Currency"/>
</viz:feeds>
</viz:VizFrame>
This is the relevant part of the code in the controller:
plotArea: {
dataLabel: {
visible: false
},
dataPointStyle: {
"rules":
[
{
"dataContext": {"idTurnover": {"min": 0}},
"properties": {
"color":"sapUiChartPaletteSemanticBad"
},
"displayName":"Loss"
},
{
"dataContext": {"idTurnover": {"max": 0}},
"properties": {
"color":"sapUiChartPaletteSemanticGood"
},
"displayName":"Profit"
}
],
"others":
{
"properties": {
"color": "sapUiChartPaletteSequentialHue1"
},
"displayName":"Cost"
}
}
},
With this code, the Cost bar is always the same color, the turnover bar is red when turnover is less then 0 and green when more then 0. But in stead of comparing the value with 0, I want to compare it to the Cost bar. If Turnover >= Cost, color is sapUiChartPaletteSemanticGood, if Turnover < Cost, color is sapUiChartPaletteSemanticBad. How can these 2 values be compared?