cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove Default value(No Data) of SAPUI5 Chart(Line,Bar,Pie) ?

Former Member
0 Kudos

Hi  ,

  

I am facing some issue when I am trying to display a chart  firstly  it shows the No Data and after few seconds it shows the chart.

  

It is showing No Data till the time JsonModel is trying to load data from the Backend.

  

I found some solution but ie depends on control like button and I don't think so it's useful.

  

Please have a look.

  

function chart(){

          

         var line = new sap.viz.ui5.Line(

                     {

                           width : "800px",

                         height : "400px",

                          plotArea : {

                                 'colorPalette' : d3.scale.category20().range()

                                 },

                                 selectionMode: 'single',

                        title : {

                             visible :false,

                            text : 'Stock Data'

                         },

                         dataset : dataset

                     });

  

         line.setModel(oModel);

           line.setBusyIndicatorDelay(0);

           var bBusy = dataset.isBusy(); // it shows the loading image on div but no use of that.

           line.setBusy(bBusy);

           line.placeAt("content");

       //Create a button to toggle busy mode

           /*****    var oBtn2 = new sap.ui.commons.Button({

              text : "set loading-mode: on",

              press : function() {

                  var bBusy = !line.isBusy();

                  bBusy ? oBtn2.setText("set loading-mode: off") : oBtn2.setText("set loading-mode: on")

                  line.setBusy(bBusy);

              }

          });

             line.placeAt("content");   ********/

       }

  

I would appreciate if somebody would give some suggestion.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This code will help to change the default value of SAPUI5 Chart(Line,Bar,Pie).

  var oTextView = new sap.ui.commons.TextView();

    oTextView.setText("Please wait, loading data");

var pie = new sap.viz.ui5.Donut(

                    {

                        width : "800px",

                        height : "400px",

                         plotArea : {

                                'colorPalette' : d3.scale.category20().range()

                                },

                         title : {

                            visible :false,

                            text : 'Stock Data'

                        },

                        dataset : dataset,

                        noData :  oTextView

                    });

       

         pie.setModel(oModel);

 

         pie.placeAt("content");

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

mabe the "nodata" aggregation is a solution for you?

https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.viz.ui5.core.BaseChart.html#construc...

Regards

Stefan

Former Member
0 Kudos

Thanks For your quick reply .

How to use setNoData ? ,I tried some example but it's throwing error.

Can you put a small snippet of code ?

As I am very new with SAPUI5 so it's little tough to get every thing in one shot.