Ammap行来自外部JSON文件的模拟

时间:2017-12-06 08:40:54

标签: javascript php ajax amcharts

我正在尝试使用dataLoader将外部JSON数据插入到我的ammap中,并使用这些数据为ammap地图中postProcess上的线设置动画

moment('20171206T062406927Z').format('D-MMM-YYYY');

我想在加载worldLow地图后插入json文件,并在外部json文件中添加经度和经度以及动画。

json_file

async

它警告错误。

1 个答案:

答案 0 :(得分:0)

除了引用您的属性外,您无法将变量传递到JSON中。您需要扩展pcSVG变量所代表的SVG字符串的实例。使用animation across lines demo中的目标SVG:

{
        "map": "worldLow",
        "getAreasFromMap": true,
        "linkToObject": "london",
        "images": [{
                "id": "london",
                "color": "#000000",
                "type": "circle",
                "title": "London",
                "latitude": 51.5002,
                "longitude": -0.1262,
                "scale": 1.5,
                "zoomLevel": 1.74,
                "lines": [{
                        "latitudes": [51.5002, 37.483577],
                        "longitudes": [-0.1262, -89.824219]
                }]
        }, {
                "svgPath": "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z",
                "title": "London",
                "latitude": 51.5002,
                "longitude": -0.1262
        }, {
                "svgPath": "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z",
                "title": "Prague",
                "latitude": 37.483577,
                "longitude": -89.824219
        }]
}

Demo

另请注意,如果您要返回正确的地图dataProvider对象,则不需要postProcess回调。只有当您返回不兼容且需要将数据转换为地图库理解的内容时才需要postProcess,因此您的postProcess调用是不必要的。