@amcharts/amcharts5-mcp 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/map.md +75 -88
- package/package.json +1 -1
package/content/map.md
CHANGED
|
@@ -243,22 +243,20 @@ Two data patterns — polygon IDs or explicit coordinates.
|
|
|
243
243
|
|
|
244
244
|
**Pattern 1: `sourceId` / `targetId` (country codes)**
|
|
245
245
|
|
|
246
|
-
IDs use ISO 3166-1 alpha-2 codes matching the geodata.
|
|
246
|
+
IDs use ISO 3166-1 alpha-2 codes matching the geodata. Set data directly — `MapSankeySeries` auto-resolves `sourceId`/`targetId` once the referenced `polygonSeries` finishes loading, so data can be set at any time:
|
|
247
247
|
|
|
248
248
|
```js
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
]);
|
|
256
|
-
});
|
|
249
|
+
sankeySeries.data.setAll([
|
|
250
|
+
{ sourceId: "BR", targetId: "DE", value: 350 },
|
|
251
|
+
{ sourceId: "BR", targetId: "US", value: 450 },
|
|
252
|
+
{ sourceId: "DE", targetId: "FR", value: 150 },
|
|
253
|
+
{ sourceId: "DE", targetId: "PL", value: 100 }
|
|
254
|
+
]);
|
|
257
255
|
```
|
|
258
256
|
|
|
259
|
-
**Pattern 2: Explicit coordinates
|
|
257
|
+
**Pattern 2: Explicit coordinates**
|
|
260
258
|
|
|
261
|
-
When using `sourceLongitude`/`sourceLatitude`/`targetLongitude`/`targetLatitude`,
|
|
259
|
+
When using `sourceLongitude`/`sourceLatitude`/`targetLongitude`/`targetLatitude`, centroid lookup is skipped entirely:
|
|
262
260
|
```js
|
|
263
261
|
sankeySeries.data.setAll([
|
|
264
262
|
{
|
|
@@ -271,17 +269,15 @@ sankeySeries.data.setAll([
|
|
|
271
269
|
|
|
272
270
|
**Waypoints** — route flows through intermediate points:
|
|
273
271
|
```js
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
]);
|
|
284
|
-
});
|
|
272
|
+
sankeySeries.data.setAll([
|
|
273
|
+
{
|
|
274
|
+
sourceId: "GB", targetId: "JP", value: 40,
|
|
275
|
+
waypoints: [
|
|
276
|
+
{ longitude: 30, latitude: 65 },
|
|
277
|
+
{ longitude: 90, latitude: 55 }
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
]);
|
|
285
281
|
```
|
|
286
282
|
|
|
287
283
|
**WARNING:** Never call `polygonSeries.data.setAll()` with custom objects — this replaces all geoJSON-derived data items, breaking MapSankeySeries centroid resolution. To set per-country properties (like colors), iterate existing data items after `datavalidated` instead:
|
|
@@ -405,16 +401,14 @@ Bullets automatically hide on the back side of the globe (orthographic projectio
|
|
|
405
401
|
The same country can be both target and source — incoming and outgoing bands share unified stacking at intermediate nodes:
|
|
406
402
|
|
|
407
403
|
```js
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
]);
|
|
417
|
-
});
|
|
404
|
+
sankeySeries.data.setAll([
|
|
405
|
+
// Level 1: Producers > Hubs
|
|
406
|
+
{ sourceId: "BR", targetId: "DE", value: 350 },
|
|
407
|
+
{ sourceId: "VN", targetId: "DE", value: 200 },
|
|
408
|
+
// Level 2: Hubs > Consumers
|
|
409
|
+
{ sourceId: "DE", targetId: "FR", value: 150 },
|
|
410
|
+
{ sourceId: "DE", targetId: "PL", value: 100 }
|
|
411
|
+
]);
|
|
418
412
|
```
|
|
419
413
|
|
|
420
414
|
### Animating bullets along lines (positionOnLine)
|
|
@@ -1222,36 +1216,34 @@ Demonstrates: `MapSankeySeries` with `sourceId`/`targetId` data (country codes),
|
|
|
1222
1216
|
});
|
|
1223
1217
|
});
|
|
1224
1218
|
|
|
1225
|
-
// Set data
|
|
1226
|
-
//
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
]);
|
|
1254
|
-
});
|
|
1219
|
+
// Set data directly — MapSankeySeries auto-resolves sourceId/targetId
|
|
1220
|
+
// once polygonSeries finishes loading.
|
|
1221
|
+
sankeySeries.data.setAll([
|
|
1222
|
+
// Producers > Hubs
|
|
1223
|
+
{ sourceId: "BR", targetId: "DE", value: 350 },
|
|
1224
|
+
{ sourceId: "BR", targetId: "US", value: 450 },
|
|
1225
|
+
{ sourceId: "BR", targetId: "IT", value: 200 },
|
|
1226
|
+
{ sourceId: "VN", targetId: "DE", value: 200 },
|
|
1227
|
+
{ sourceId: "VN", targetId: "BE", value: 150 },
|
|
1228
|
+
{ sourceId: "CO", targetId: "US", value: 250 },
|
|
1229
|
+
{ sourceId: "CO", targetId: "DE", value: 80 },
|
|
1230
|
+
{ sourceId: "ET", targetId: "DE", value: 60 },
|
|
1231
|
+
{ sourceId: "ET", targetId: "BE", value: 40 },
|
|
1232
|
+
{ sourceId: "ID", targetId: "US", value: 80 },
|
|
1233
|
+
{ sourceId: "HN", targetId: "DE", value: 60 },
|
|
1234
|
+
{ sourceId: "HN", targetId: "BE", value: 40 },
|
|
1235
|
+
// Hubs > Consumer Markets
|
|
1236
|
+
{ sourceId: "DE", targetId: "FR", value: 150 },
|
|
1237
|
+
{ sourceId: "DE", targetId: "PL", value: 100 },
|
|
1238
|
+
{ sourceId: "DE", targetId: "SE", value: 80 },
|
|
1239
|
+
{ sourceId: "DE", targetId: "RU", value: 120 },
|
|
1240
|
+
{ sourceId: "BE", targetId: "GB", value: 100 },
|
|
1241
|
+
{ sourceId: "BE", targetId: "NL", value: 80 },
|
|
1242
|
+
{ sourceId: "IT", targetId: "GR", value: 50 },
|
|
1243
|
+
{ sourceId: "IT", targetId: "AT", value: 40 },
|
|
1244
|
+
{ sourceId: "US", targetId: "CA", value: 120 },
|
|
1245
|
+
{ sourceId: "US", targetId: "JP", value: 80 }
|
|
1246
|
+
]);
|
|
1255
1247
|
|
|
1256
1248
|
// Set country names on auto-created nodes and animate bullets
|
|
1257
1249
|
var countryNames = {
|
|
@@ -1270,31 +1262,27 @@ Demonstrates: `MapSankeySeries` with `sourceId`/`targetId` data (country codes),
|
|
|
1270
1262
|
}
|
|
1271
1263
|
});
|
|
1272
1264
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
var
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
});
|
|
1297
|
-
}, 100);
|
|
1265
|
+
am5.array.each(sankeySeries.dataItems, function(dataItem) {
|
|
1266
|
+
var bullets = dataItem.bullets;
|
|
1267
|
+
if (bullets) {
|
|
1268
|
+
am5.array.each(bullets, function(bullet) {
|
|
1269
|
+
var randomDur = 3000 + Math.random() * 3000;
|
|
1270
|
+
var delay = Math.random() * randomDur;
|
|
1271
|
+
setTimeout(function() {
|
|
1272
|
+
var sprite = bullet.get("sprite");
|
|
1273
|
+
if (sprite) sprite.set("visible", true);
|
|
1274
|
+
bullet.animate({
|
|
1275
|
+
key: "locationX",
|
|
1276
|
+
from: 0,
|
|
1277
|
+
to: 1,
|
|
1278
|
+
duration: randomDur,
|
|
1279
|
+
easing: am5.ease.linear,
|
|
1280
|
+
loops: Infinity
|
|
1281
|
+
});
|
|
1282
|
+
}, delay);
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1298
1286
|
});
|
|
1299
1287
|
|
|
1300
1288
|
// Title
|
|
@@ -1606,7 +1594,6 @@ Demonstrates: `MapSankeySeries` with explicit `sourceLongitude`/`sourceLatitude`
|
|
|
1606
1594
|
var wpPortugal = { longitude: -10, latitude: 39 };
|
|
1607
1595
|
var viaAtlantic = [wpHormuz, wpAden, wpSuez, wpSicily, wpPortugal];
|
|
1608
1596
|
|
|
1609
|
-
// No datavalidated wrapper needed — explicit coordinates resolve immediately
|
|
1610
1597
|
sankeySeries.data.setAll([
|
|
1611
1598
|
// Ras Tanura (Saudi Arabia)
|
|
1612
1599
|
flow(rasTanura, "Ras Tanura", ningbo, "Ningbo", 1100, viaChina),
|