Hi All,
We have one issue. In UI5 viz bar chart, we want to change datalabel value. Instead of showing datalabel value, we want to show another value in that place but bar should be plotted for original value. I tried to change datalabel value in plotarea property, but it is not working. Please see the code below.
Data:
DEFECT_TYPE | DATE_DIFF | COUNT |
---|
Noisy | 7 | 4 |
and the chart is:
![S1.png]()
Code:
var oVizFrame = new sap.viz.ui5.controls.VizFrame("negativeChart", {
height : "450px",
width : "100%"
});
oVizFrame.setVizType('bar');
var oDataset = new sap.viz.core.FlattenedDataset({
dimensions : [ {
name : "Defect Type",
value : "{DEFECT_TYPE}"
} ],
measures : [ {
name : 'Avg Difference',
value : '{DATE_DIFF}'
}, {
name : 'Count',
value : '{COUNT}'
} ],
data : {
path : "/DEFECT_COUNTS"
}
});
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(result);
oDataset.setModel(oModel);
oVizFrame.setDataset(oDataset);
oVizFrame.setModel(oModel);
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "valueAxis",
'type' : "Measure",
'values' : [ "Avg Difference" ]
}), feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "categoryAxis",
'type' : "Dimension",
'values' : [ "Defect Type" ]
}), feedValueAxis2 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid' : "tooltip",
'type' : "Measure",
'values' : [ "Avg Difference", "Count" ]
})
oVizFrame.addFeed(feedValueAxis);
oVizFrame.addFeed(feedValueAxis2);
oVizFrame.addFeed(feedCategoryAxis);
oVizFrame.setVizProperties({
general : {
layout : {
padding : 0.04
}
},
plotArea : {
dataPointStyle : {
"rules" : [ {
"dataContext" : {
"Avg Difference" : {
"min" : 6.1,
"max" : 100
}
},
"properties" : {
"color" : "#4aa133",
dataLabel : {
text : "Count"
}
},
"displayName" : "Avg Diff > 6"
}, {
"dataContext" : {
"Avg Difference" : {
"min" : 3.1,
"max" : 6
}
},
"properties" : {
"color" : "#FFBF00"
},
"displayName" : "Avg Diff > 3 < 6"
}, {
"dataContext" : {
"Avg Difference" : {
"min" : 0,
"max" : 3
}
},
"properties" : {
"color" : "#FF0000"
},
"displayName" : "Avg Diff > 0 < 3"
} ],
"others" : {
"properties" : {
"color" : "#FF0000"
},
"displayName" : "Avg Diff others"
}
},
dataLabel : {
visible : true,
}
},
title : {
visible : true,
text : "Bar Chart"
},
});
and the expected chart is as below. we want value of count (4) in place of 7 (date_diff column). But Chart should be for date_diff value only.
![S2.png]()
can you please help to solve this issue?
Thanks,
Senthil