Forum

Jennifer Häfner
Moderator
    Has successfully completed the online course Intermediate (200)
    Has successfully completed the online course Advanced (300)
    Has successfully completed the online course Basics (100)
    Has successfully completed the online course Advanced (310)
    Has successfully completed the online course Advanced (320)
    Has successfully completed the Intermediate Certification
    Has successfully completed the Advanced Certification
3 years, 6 months ago #29795
Up
0
Down
::

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.

Attachments:
You must be logged in to view attached files.