Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Answered

Bar chart resolution for different screen size

 Hi Team,


I have used Bar Chart from sap.viz library. I can able to see the chart in my mobile phone, but the chart size is not adjusting as per the screen size.


Is their any option to dynamically set the size as per the screen size.



Best Answer

Hi Prakash


I have tested this scenario in our system, and everything works fine.


Have you set the Chart height = 100%

Have you set the Chart width = 100% 

Have you set the Page to enableScrolling = false


The Chart will resize itself. If you would like to turn off the redraw event, set PlotArea.Animation resizing = false;



Regards

Ole Andre 


Hi


For the event handling on the charts, you can use the selectData event with the following code:


var data = oEvent.getParameter("data");

var value = data[0].data[0].val;




Hi Ole, 

Thank you. it is working fine. i forget to set the height = 100%.

One more doubt what is the js code to get the selected part in Pie Chart.How to i get the value of the selected part. Please guide me if you have any documentation availble for the js code of all the events of UI elements.


Thanks,

Prakash

Answer

Hi Prakash


I have tested this scenario in our system, and everything works fine.


Have you set the Chart height = 100%

Have you set the Chart width = 100% 

Have you set the Page to enableScrolling = false


The Chart will resize itself. If you would like to turn off the redraw event, set PlotArea.Animation resizing = false;



Regards

Ole Andre 

Hi Ole,

I have added the code, but still i am able to see half of the chart. PFA screen shot.


 

IMG_3950.JPG
(1.9 MB)
If you use the event on the sap.m.App object, orientationchange and set chartname.rerender(); it will adjust the size when changing orientation. Regards Ole Andre
Hi Ole,

  Yes i have done the changes,but if my mobile is in portrait then the chart looks good,but if i change to landscape mode i can only see half of the chart. I can't even scroll it.
How would i adjust dynamically to the screen size.

Thanks,
Prakash

 

Hi Prakash


For the charts, you can set the Property width=100%, then it will use the full size of your mobile screen. To be able to use 100% height, you need to put the chart into a sap.m.Page with Property enableScrolling = false, or you can put it into a container with fixed height.


If the chart does not display as intended, try <Chart>.rerender();


Regards

Ole Andre

Login or Signup to post a comment