我的应用中有一些带有大量数据(引脚)的 amCharts(版本 3)地图。我希望它在不冻结页面的情况下加载数据。我可以通过哪种方式实现这一点。我正在尝试 proccessTimeout、setInterval、setTimeout。没有什么帮助。
1 回答
2
amMaps 3 未针对处理大量数据进行优化。您可以尝试一些解决方法来帮助提高性能,但这不是 100% 的修复,如果数据量非常大,可能会达到上限。
一种选择是创建多级向下钻取,您可以在其中以区域标记的形式显示较小的数据子集。当用户单击其中一个时,将显示基础数据点,例如:
"dataProvider": {
"map": "usa2Low",
"images": [ {
"svgPath": targetSVG,
"label": "San Diego", //Clicking on the San Diego marker
"zoomLevel": 14, //will reveal markers for Imperial Beach, El Cajon, etc
"scale": 1,
"title": "San Diego",
"latitude": 32.715738,
"longitude": -117.161084,
"images": [ {
"svgPath": targetSVG,
"scale": 0.7,
"title": "Imperial Beach",
"latitude": 32.586299,
"longitude": -117.110481
}, {
"svgPath": targetSVG,
"scale": 0.7,
"title": "El Cajon",
"latitude": 32.802417,
"longitude": -116.963539
}, {
"svgPath": targetSVG,
"scale": 0.7,
"title": "University City",
"latitude": 32.861268,
"longitude": -117.210045
}, {
"svgPath": targetSVG,
"scale": 0.7,
"title": "Poway",
"latitude": 32.969635,
"longitude": -117.036324
} ]
} ]
这是一个示例:https ://www.amcharts.com/docs/v3/tutorials/map-marker-drill-down/
另一种选择是使用groupId
and仅在特定缩放级别上显示某些数据点zoomLevel
,这可以最大限度地减少最初需要渲染的点数,直到用户查找更多细节,类似于前面的示例,但不使用嵌套结构:
"dataProvider": {
"map": "worldLow",
"images": [ {
"groupId": "minZoom-2", //minZoom-2 group of images, visible at zoomLevel 5
"svgPath": targetSVG,
"zoomLevel": 5,
"scale": 0.5,
"title": "Vienna",
"latitude": 48.2092,
"longitude": 16.3728
},
// ... other images with group minZoom-2 omitted
// ...
{
"groupId": "minZoom-2.5", //minZoom-2.5 group, visible at
"svgPath": targetSVG,
"zoomLevel": 5,
"scale": 0.5,
"title": "Pyinmana",
"latitude": 19.7378,
"longitude": 96.2083
},
// ... etc
// create a zoom listener which will check current zoom level and will toggle
// corresponding image groups accordingly
map.addListener( "rendered", function() {
revealMapImages();
map.addListener( "zoomCompleted", revealMapImages );
} );
function revealMapImages( event ) {
var zoomLevel = map.zoomLevel();
if ( zoomLevel < 2 ) {
map.hideGroup( "minZoom-2" );
map.hideGroup( "minZoom-2.5" );
} else if ( zoomLevel < 2.5 ) {
map.showGroup( "minZoom-2" );
map.hideGroup( "minZoom-2.5" );
} else {
map.showGroup( "minZoom-2" );
map.showGroup( "minZoom-2.5" );
}
}
这是一个例子:https ://www.amcharts.com/docs/v3/tutorials/show-groups-map-images-specific-zoom-level/
于 2018-12-11T04:53:53.180 回答