Skip to Content
avatar image
Former Member

is it possible to set css by script in sap design studio?

As follow picture,I want the bubble color auto changed by data,eg:if the value>0 the color red,else the color blue.

I've use follow code to get data,but if I follow like this,all of bubble will red or blue,not like I want just value less than 0.

How can I do to make it realize?Just the value greater than 0 will red,and others blue?

var va=DS_1.getMembers("ZCQYF", 2000);
va.forEach(function(element, index) {
var v=DS_1.getData("OVERDUE_TTL", {"ZCQYF": element.internalKey}).value;
LISTBOX_1.addItem(v+"", v+"");
 if(v>=0){
   LISTBOX_1.setCSSClass("red");
 }else if(v<0){
  LISTBOX_1.setCSSClass("blue");
 }
});

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 27, 2016 at 08:18 AM

    Hi jing,

    How are you using Geo or Leaflet Map??

    If leaflet map, Please refer the below URL,

    https://blogs.sap.com/2016/01/07/design-studio-16-sdk-leaflet-maps-for-more-mapping-goodness/

    Regards,

    Vidhya.C

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vidhya.

      I'm use Geo Map.I've view the url that you recommend ,but I still like use Geo Map,which bubble maybe more suit to my situation.

      Thanks.

      Jing

  • Dec 27, 2016 at 12:42 PM

    Hi Jing,

    The scenario you have documented is confusing. It appears that you would like to dynamically change the bubble colours in a geo map via CSS yet your script example is changing the CSS applied to a List Box. Can you clarify?

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Mustafa Bensan

      Hi Mustafa.

      Maybe I'm not express clear.

      I want to realize a situation in geomap that when the data less than 0,then "red",else "blue".Above code is just an eg to show that is a way to realize color according to data.But if I use geomap,I can't use html,so whether there have another way to realize color changed by data?

      Thanks .

      Jing