Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

SAP HANA XS and SAPUI5 - how to live update a chart?

$
0
0

Hi all,

 

we are developing with SAP HANA Developer Edition and SAPUI5.

We read data with an XSJS File out of the Database ( i read the recent 40 datasets of the table with an SQL statement and LIMIT).

 

This is the code in my controller.js which calls the XSJS service that reads the data out of HANA DB.

 

loadChart: function() {

       

        var model = new sap.ui.model.json.JSONModel();

        var aUrl = '../../../dev/data_HANAXS/services/readdata.xsjs?cmd=loadChart';

        jQuery.ajax({

            url: aUrl,

            method: 'GET',

            dataType: 'json',

            success: function(data) {

               

                model.setData({modelData : data});

                

            }

        });

               

        return model;

                     

    },


Then in my view.js i set the model for the line chart and i can see my data.


var model = oController.loadChart();

linechart.setModel(model);   

 

What i want to do now is to live update the chart in regular time intervals, i am using SETINTERVAL ( you can also use jQuery.sap.delayedCall ) for that:

 

function updateChart() {

           

            var model = oController.loadChart();

            linechart.setModel(model);

        }

 

setInterval(updateChart, 5000); // every 5 seconds refresh the chart

 

 

And this works fine BUT the COMPLETE CHART (including x-axis and y-axis) is drawn again every 5 seconds , what i want to know is how can i realize it so that ONLY the DATA LINE is drawn again every 5 seconds?

 

It would be great if anyone could help me regarding this issue?

 

It must be possible to do a live update of a chart especially for cases where you get steadily new data that has to be visualized.

 

Regards & Thanks,

 

Andreas


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>