所谓连接地图是指可以在地图上表示线路、区域、景观路线、飞行航线等,经常这种地图被用于地理、航空、经济、广告、旅游名胜等领域,可以为线路设置箭头,设置连线的颜色、粗细、连线的起始宽度和结束宽度,使用
AnyMap可以快速帮助开发人员创建此类地图,下面主要介绍怎么使用
AnyMap控件来快速创建该类连接地图,具体如下:
1.首先看怎么在地图上连接数据点,如下面的数据,第一和第二个数据代表了起始节点的经度和纬度,第三个和第四个数据代表结束节点的坐标
[50.8, -3.6, 51.1, -2.8],
[51.1, -2.8, 50.7, -2.4],
[50.7, -2.4, 50.8, -1.6],
[50.8, -1.6, 51.5, -0.16],
[51.5,-0.16, 51.7, -1.29],
[51.7, -1.29, 52.2, 0.27]
]);
2.设置连接线的颜色、连接线的标记等
{points: [50.8, -3.6, 51.1, -2.8], stroke:'red', to: "Exmoor National Park", marker: {fill: "#9fa8da"}},
{points: [51.1, -2.8, 50.7, -2.4], stroke:'green', to: "Maiden Castle"},
{points: [50.7, -2.4, 50.8, -1.6], stroke:'green', to: "New Forest National Park"},
{points: [50.8, -1.6, 51.5, -0.16], stroke:'green', to: "Stonehenge"},
{points: [51.5,-0.16, 51.7, -1.29], to: "London"},
{points: [51.7, -1.29, 52.2, 0.27], to: "Oxford"},
{points: [52.2, 0.27, 53.3, -1.5], to: "Cambridge"},
{points: [53.3, -1.5, 53.4, -3.02], to: "Peak District National Park"},
{points: [53.4, -3.02,54.1,-3.29], to: "Liverpool"},
{points: [54.1, -3.29,54.4,-3.18], to: "The National Trust"},
{points: [54.4,-3.18, 54.5,-3.4], stroke:'green', to: "Hadrian's Wall"},
{points: [54.5,-3.4, 55.2, -1.9], stroke:'red', to: "Nunnykirk Caravan Club Site"},
{points: [55.2, -1.9, 56.4, -3.5], to: "Edinburgh"},
{points: [56.4, -3.5, 57.1, -2.19], stroke:'green', to: "Aberdeen"}
]);
3,设置连接线的起始宽度和结束宽度
series.startSize(7);
series.endSize(0);