Skip to Content

vizFrame - change datalabel with Dataset value

I'm creating a report with vizFrame. It's showing the duration of jobs.

The HANA view looks like this:

AB      : C      : 01-01-2017 : 4
AC      : E      : 01-02-2017 : 5Etc.

For now the dataLabel is showing the value of the duration column, wich is the measure for the Dataset. But I would like the dataLabel to show the Status of that job. On this page ( found a simular question, but I'm unable to apply it to my code. I'm not sure how to get data data from the Status column, meaning this part:

oEvent.text = chartobj.getDataset().getModel().getData()["DEFECT_COUNTS"][oEvent.ctx._context_row_number].COUNT;

This is how my report looks for now:

This is my code:



  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<title>Test Charts with oData</title>

<script id="sap-ui-bootstrap" src="" type="text/javascript" data-sap-ui-libs="sap.ui.core,sap.viz" data-sap-ui-theme="sap_goldreflection">
    var oModel = new sap.ui.model.odata.ODataModel('Jobs_Statistics.xsodata', true); //true=JSON false=XML performance JSON is sn
    var oDataset = new{
        dimensions: [{
            name: 'Start_Datum',
            value: "{START_DATUM_CHAR}"},
            name: 'Data Mart',
            value: "{DATAMART}"}],
        measures: [{
            name: 'Doorlooptijd',
            value: "{DOORLOOPTIJD_IN_SEC}"}],
        data: {
            path: "/JOBS_STATS"},
    var oVizFrame = new sap.viz.ui5.controls.VizFrame({
        height : "400px",
		width : "100%",
		vizType : "info/column"
          plotArea: {
              dataLabel: {
                  visible: true, 
                  renderer: function(oEvent) {
                      //oEvent.text = 'tst';}
//How to deal with this part?????:
                      oEvent.text = oVizFrame.getDataset().getModel().getData()["/JOBS_STATS"][ctx._context_row_number]["STATUS"]}
          legend: {title: {visible: true}, label:{style:{color:'#FF0000'}}},
          title: {visible:true, text:'Statistieken rapportages'}
    var feedPrimaryValues = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid' : "valueAxis",
			'type' : "Measure",
			'values' : ["Doorlooptijd"]
	var feedAxisLabels = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid' : "categoryAxis",
			'type' : "Dimension",
			'values' : ["Start_Datum"]
	var feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem({
			'uid' : "color",
			'type' : "Dimension",
			'values' : ["Data Mart"]


<body class="sapUiBody" role="application">
    <div id="content"></div>
test.jpg (31.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 16, 2017 at 04:01 PM

    What is your model structure/hierarchy. from the code it seems like you are trying to access the attribute /JOB_STATS/0/STATUS, but your HANA view doesn't have the field called STATUS

    put a console statement in render function for ctx._context_row_number

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 18, 2017 at 09:29 AM

    The second column in the hana view is the STATUS column. Not sure what you mean with the last sentence. I can't find any documentation about the ctx._context_row_number part just the example I linked.

    Add comment
    10|10000 characters needed characters exceeded