Map icon color modification

Hi all,
I was wondering if it is possible to change the color of the icon in the map of an asset depending on the value of an attribute. Thanks!

Hi, unfortunately that’s not possible currently. However, we are working on showing data on the map, and using the icon colour itself to reflect the value is a good idea! Give us some time :slight_smile:

1 Like

Hi Perrochiba,

Your patience has paid off! We implemented the feature where the marker colour can change depending on the value of one of its attributes.

In the manager_config of you project, you can add details on the colour and threshold values you want to set for an asset type. More about this config on the wiki in the 'Map - Marker config section.

Make sure to add it in:

{
  "pages": {
    "map": {
      _HERE_
    }
  }
}

Example image:

1 Like

Hi Don,
thanks for the reply. I was wondering if it’s possible to change the color of the icon of a specific asset. The example in the wiki changes the color of all the “ElectricityProducerSolarAsset” assets. Thanks!

No that’s not possible at the moment.
If you really wanted to, you could create a new asset type in a custom project that has a specific colour. But that is quite the workaround… (don’t do this :wink: )

1 Like

Hey Don,

works this with bool attributes too?

Hi Don,
thanks for the reply. I cant get it to work, the manager config json is:

{
  "pages": {
    "map": {
      "markers": {
        "ElectricityProducerSolarAsset": {
          "attributeName": "energyExportTotal",
          "showLabel": true,
          "showUnits": true,
          "colours": {
            "type": "range",
            "ranges": [
              {
                "max": 50,
                "colour": "39B54A"
              },
              {
                "max": 80,
                "colour": "F7931E"
              },
              {
                "max": 100,
                "colour": "C1272D"
              }
            ]
          }
        }
      }  
    }
  },
  "realms": {
    "default": {
      "appTitle": "ALTEC IoT",
      "styles": ":host > * {--or-app-color2: #F9F9F9; --or-app-color3: #22211f; --or-app-color4: #6fa8dc; --or-app-color5: #CCCCCC;}",
      "logo": "/images/logo.png",
      "logoMobile": "/images/logo-mobile.png",
      "favicon": "/images/favicon.png"
    }
  }
}

There’s something im missing? Thanks!

otherway would be to add a rule when bool 1 then attribute 100

Yes, it works for booleans and strings too. A very useful example:

"LightAsset": {
  "attributeName": "onOff",
  "showLabel": true,
  "showUnits": false,
  "colours": {
    "type": "boolean",
    "false": "F7931E",
    "true": "39B54A"
  }
},
"ParkingAsset": {
  "attributeName": "notes",
  "showLabel": true,
  "showUnits": false,
  "colours": {
    "type": "string",
    "hi": "F7931E",
    "ha": "39B54A",
    "ho": "C1272D"
  }
},

image

1 Like

Hi perrochiba,

You might be looking at it as the admin user. Since that user is the superuser the manager config does not apply to him. This way that user always sees everything in the system (only realm colour and image styling applies to him)
Log in as a different user and you will probably see the effect of your config.

Don

1 Like

Hi Don,
that was the problem indeed. Thanks. Im trying to log to other realm with no success. localhost always redirect me to the master realm log, any help?

To load a specific realm for the manager UI use the realm query parameter:

manager/?realm=myrealm

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.