Moderator
3 years, 6 months ago
#29795
::
Hi Christian,
You have to format the data that comes from the connector call. You can do this in your business object (that’s why you have to use the connector call inside a business object: to format the data coming from the connector for the chart widget). Here is an example that simply converts the values of a dataset into datapoint objects:
var oData = {
"datasets": [{
"color": "#00AF00",
"label": "Tenant 1",
"value": 1
}, {
"color": "#ff0000",
"label": "Tenant 2",
"value": 2
}, {
"color": "#cc33ff",
"label": "Tenant 3",
"value": 3
}],
"labels": [{
"label": "Status_Open"
}]
};
// write the value into a datapoints object for each dataset
oData.datasets.forEach(function(oDataset) {
oDataset.datapoints = [{
value: oDataset.value
}];
});
output.datasets = oData.datasets;
output.labels = oData.labels;
When the datasets and labels are mapped to a bar chart, the resulting chart will look like the chart in the attachment.