UIViewMap not centered when data collection empty


#1

I’ve an original AlertMapComponent (a UIViewMap component) that I’m trying to force it to center on a given position, I tried to use the center field of UIViewMap as follows:

ui module EnergyManagement {
    component AlertMapComponent {
        "component": "UIViewMap",
        "autoLoadData": false,
        "icon": "map-marker",
        "cluster": true,
        "lat": "source.geometry.latitude",
        "lng": "source.geometry.longitude",
        "markerColors": {
            "field": "priority",
            "colorRange": [
                "999999",
                "ff0000"
            ],
            "valueRange": [
                1,
                10
            ]
        },
        "center": [
            40.0017,
            83.0197
        ],
        "infoWindowTpl": [
            "<h5><a href='/energymgt/facility/<%= source.id %>'><% if (typeof source.name != 'undefined') { %><%= C3.util.format('titleize', source.name) %><% } %></a></h5>",
            "<table style='margin-bottom: 15px'>",
            "<tr>",
            "<td><% if (typeof source.address1 != 'undefined') { %><%= C3.util.format('titleize',source.address1) %><% } %></td>",
            "</tr>",
            "<tr>",
            "<td><% if (typeof source.contacts != 'undefined') { %><%= C3.util.format('titleize',source.contacts[0].partyRole.name) %><% } %></td>",
            "</tr>",
            "<tr>",
            "<td class='text-left' style='padding-right: 5px;'>Priority</td>",
            "<td><% if (typeof alert.priority != 'undefined') { %><%= C3.script.helpers.numberFormat(alert.priority, 0, '.', ',') %><% } %></td>",
            "</tr>",
            "<tr>",
            "<td><% if (typeof alert.name != 'undefined') { %><%= C3.util.format('titleize', alert.name) %><% } %></td>",
            "</tr>",
            "<tr>",
            "<td><% if (typeof eventTimestamp != 'undefined') { %><%= C3.script.helpers.localTime(eventTimestamp, 'hh:mm a MMMM, D, YYYY') %><% } %></td>",
            "</tr>",
            "</table>"
        ]
    }
}

This is not working for me!

Does this field works only when there is data or it’s also supposed to work when no data is available?


#2

I’m having the same issue and reviewed the documentation. I’m not clear on the syntax to have the map center on a hard coded lat/long.