@amcharts/amcharts5-mcp 1.9.3 → 1.9.4

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.
@@ -0,0 +1,248 @@
1
+ ---
2
+ title: "Mars Landing Sites"
3
+ source: "https://www.amcharts.com/demos/mars-landing-sites/"
4
+ category: "maps"
5
+ scraped: "2026-10-25"
6
+ ---
7
+
8
+ Mars as a slowly turning globe, covered with the Viking orbiters' color map of its surface, and the ten landers and rovers that worked there, from Viking 1 in 1976 to Perseverance and Zhurong in 2021. In teal, two places that are fiction: the Ares 3 and Ares 4 sites from the novel The Martian.
9
+
10
+ Maps of other worlds: A map chart doesn't have to show the Earth. Give a raster series any whole-planet picture in the usual equirectangular layout, and the globe wears it, turning and zooming like any map; markers, lines and a grid go on top by latitude and longitude, as on the Earth. The amCharts CDN has such pictures of the Moon, Mars, Venus, Jupiter, Io and Ganymede.
11
+
12
+ Good for:
13
+ - Space missions, landings and probes
14
+ - Science and education pages
15
+ - An eye-catching opener for a story
16
+
17
+ Think twice when:
18
+ - Comparing places on the far side: one side shows at a time
19
+ - Exact positions: a flat map is easier to read
20
+
21
+ Prompt: Create a 3D globe of Mars that turns slowly on its own, a full turn every two minutes, covered with the amCharts CDN's picture of Mars (https://cdn.amcharts.com/lib/5/geodata/images/mars2048.jpg) and a faint latitude and longitude grid, seen a little from above, with zoom buttons. Mark the ten landers and rovers that worked on Mars (Viking 1 and 2, Pathfinder, Spirit, Opportunity, Phoenix, Curiosity, InSight, Perseverance, Zhurong) with orange circles that hide when they turn to the far side, their names beside them, and the mission, what it was, the place and the landing date on hover. Add, in teal and clearly marked fictional, the Ares 3 site (31.3N, 28.7W, Acidalia Planitia) and the Ares 4 site (3.96S, 15.2E, Schiaparelli crater) from Andy Weir's novel The Martian. Credit the picture to the USGS Astrogeology Science Center and NASA Ames Research Center. Use the amCharts 5 library with its Responsive theme.
22
+
23
+ ## JavaScript
24
+
25
+ ```javascript
26
+ // Create root element
27
+ // https://docs.amcharts.com/v5/getting-started/#root-element
28
+ var root = am5.Root.new("chartdiv");
29
+
30
+ // Set themes
31
+ // https://docs.amcharts.com/v5/concepts/themes/
32
+ root.setThemes([
33
+ am5themes_Animated.new(root),
34
+ am5themes_Responsive.new(root)
35
+ ]);
36
+
37
+ // The buttons (the zoom control) in a dark slate that suits the night sky, instead of the default blue
38
+ root.interfaceColors.setAll({
39
+ primaryButton: am5.color(0x2a3042),
40
+ primaryButtonHover: am5.color(0x3a4259),
41
+ primaryButtonDown: am5.color(0x485170),
42
+ primaryButtonActive: am5.color(0x485170),
43
+ primaryButtonStroke: am5.color(0x4a5370),
44
+ primaryButtonText: am5.color(0xe6e8f0),
45
+ primaryButtonDisabled: am5.color(0x1c2030), // the minus button, zoomed out as far as it goes
46
+ primaryButtonTextDisabled: am5.color(0x5c6278)
47
+ });
48
+
49
+ // Create the map chart: Mars as a globe that turns once every two minutes
50
+ // https://docs.amcharts.com/v5/charts/map-chart/
51
+ var chart = root.container.children.push(am5map.MapChart.new(root, {
52
+ projection: am5map.geoOrthographic(), // a globe, seen from space
53
+ panX: "rotateX", // a sideways drag spins the planet
54
+ panY: "rotateY", // an up or down drag tilts it
55
+ minZoomLevel: 0.5, // zooming out stops at half size
56
+ rotationY: -15 // a little from above, so the northern sites show
57
+ }));
58
+
59
+ // Turn Mars: a full turn every 2 minutes at a steady speed, for ever. The animation is kept, so pointing at a site
60
+ // can pause it (below)
61
+ // https://docs.amcharts.com/v5/concepts/animations/
62
+ var spin = chart.animate({ key: "rotationX", from: 0, to: 360, duration: 120000, loops: Infinity });
63
+
64
+ // A site's marker pointed at: it grows a little, and Mars stops turning so the site stays under the pointer
65
+ // https://docs.amcharts.com/v5/concepts/settings/states/
66
+ function hoverable(circle) {
67
+ circle.states.create("hover", { scale: 1.4 });
68
+ circle.events.on("pointerover", function() { spin.pause(); });
69
+ circle.events.on("pointerout", function() { spin.play(); });
70
+ return circle;
71
+ }
72
+
73
+ // Add the picture of Mars, a map of the whole planet redrawn to fit the globe as it turns: the Viking orbiters'
74
+ // colorized mosaic, read from the amCharts CDN
75
+ // https://docs.amcharts.com/v5/charts/map-chart/map-raster-series/
76
+ var rasterSeries = chart.series.push(am5map.MapRasterSeries.new(root, {
77
+ src: "https://cdn.amcharts.com/lib/5/geodata/images/mars2048.jpg"
78
+ }));
79
+
80
+ // Add a faint grid of latitudes and longitudes, every 15 degrees
81
+ // https://docs.amcharts.com/v5/charts/map-chart/graticule-series/
82
+ var graticuleSeries = chart.series.push(am5map.GraticuleSeries.new(root, {
83
+ step: 15
84
+ }));
85
+
86
+ graticuleSeries.mapLines.template.setAll({
87
+ stroke: am5.color(0xffffff), // white over the red surface...
88
+ strokeOpacity: 0.1 // ...faint
89
+ });
90
+
91
+ // Every mission that landed on Mars and worked there, where it came down (degrees, east longitude), and when
92
+ var sites = [
93
+ { name: "Viking 1", type: "Lander", place: "Chryse Planitia", date: "July 20, 1976", latitude: 22.27, longitude: -47.95 },
94
+ { name: "Viking 2", type: "Lander", place: "Utopia Planitia", date: "September 3, 1976", latitude: 47.64, longitude: 134.29 },
95
+ { name: "Pathfinder", type: "Lander and rover", place: "Ares Vallis", date: "July 4, 1997", latitude: 19.13, longitude: -33.22 },
96
+ { name: "Spirit", type: "Rover", place: "Gusev crater", date: "January 4, 2004", latitude: -14.57, longitude: 175.47 },
97
+ { name: "Opportunity", type: "Rover", place: "Meridiani Planum", date: "January 25, 2004", latitude: -1.95, longitude: -5.53 },
98
+ { name: "Phoenix", type: "Lander", place: "Vastitas Borealis", date: "May 25, 2008", latitude: 68.22, longitude: -125.75 },
99
+ { name: "Curiosity", type: "Rover", place: "Gale crater", date: "August 6, 2012", latitude: -4.59, longitude: 137.44 },
100
+ { name: "InSight", type: "Lander", place: "Elysium Planitia", date: "November 26, 2018", latitude: 4.5, longitude: 135.62 },
101
+ { name: "Perseverance", type: "Rover", place: "Jezero crater", date: "February 18, 2021", latitude: 18.44, longitude: 77.45 },
102
+ { name: "Zhurong", type: "Rover", place: "Utopia Planitia", date: "May 15, 2021", latitude: 25.07, longitude: 109.93 }
103
+ ];
104
+
105
+ // Create point series for the sites: markers that face the viewer and hide once they turn to the far side
106
+ // https://docs.amcharts.com/v5/charts/map-chart/map-point-series/
107
+ var siteSeries = chart.series.push(am5map.MapPointSeries.new(root, {
108
+ latitudeField: "latitude",
109
+ longitudeField: "longitude"
110
+ }));
111
+
112
+ // Each site: an orange circle with a white ring, and the mission, what it was, the place and the date on hover
113
+ siteSeries.bullets.push(function() {
114
+ return am5.Bullet.new(root, {
115
+ sprite: hoverable(am5.Circle.new(root, {
116
+ radius: 6,
117
+ fill: am5.color(0xff6b35), // orange, clear against the red-brown surface
118
+ stroke: am5.color(0xffffff), // with a white ring
119
+ strokeWidth: 2,
120
+ tooltipText: "[bold]{name}[/] ({type})\n{place}\nLanded {date}",
121
+ tooltipY: 0, // the tooltip points at the top of the circle, not its middle
122
+ cursorOverStyle: "pointer" // a hand over the marker: there is more to see
123
+ }))
124
+ });
125
+ });
126
+
127
+ siteSeries.data.setAll(sites);
128
+
129
+ // Create a second point series for the names: labels beside the markers, hidden on the far side with them
130
+ var labelSeries = chart.series.push(am5map.MapPointSeries.new(root, {
131
+ latitudeField: "latitude",
132
+ longitudeField: "longitude"
133
+ }));
134
+
135
+ labelSeries.bullets.push(function() {
136
+ return am5.Bullet.new(root, {
137
+ sprite: am5.Label.new(root, {
138
+ text: "{name}",
139
+ populateText: true, // fills in the name from the site's data
140
+ fill: am5.color(0xffffff),
141
+ fontSize: "0.8em",
142
+ fontWeight: "600",
143
+ centerX: am5.p50, // centered...
144
+ centerY: 0, // ...under the marker,
145
+ dy: 8, // just clear of its circle...
146
+ paddingTop: 0, // ...with none of a label's usual space above the text
147
+ interactive: false // the marker has the tooltip
148
+ })
149
+ });
150
+ });
151
+
152
+ labelSeries.data.setAll(sites);
153
+
154
+ // Create point series for two places that are fiction: the Ares 3 and Ares 4 sites from Andy Weir's novel The Martian
155
+ // (2011, a film in 2015), where NASA's HiRISE camera photographed the real ground. Teal, not orange, with
156
+ // "(fictional)" in the name and the tooltip
157
+ var fictionSeries = chart.series.push(am5map.MapPointSeries.new(root, {
158
+ latitudeField: "latitude",
159
+ longitudeField: "longitude"
160
+ }));
161
+
162
+ fictionSeries.bullets.push(function() {
163
+ var container = am5.Container.new(root, {});
164
+ // the circle has the tooltip: a tooltip takes its color from what it belongs to, and a container has none
165
+ container.children.push(hoverable(am5.Circle.new(root, {
166
+ radius: 6,
167
+ fill: am5.color(0x2ec4b6), // teal: not a real mission
168
+ stroke: am5.color(0xffffff),
169
+ strokeWidth: 2,
170
+ strokeDasharray: [2, 2], // a broken ring, as a second hint
171
+ tooltipText: "[bold]{name}[/] (fictional)\n{story}\nFrom the novel The Martian (Andy Weir, 2011)",
172
+ tooltipY: 0,
173
+ cursorOverStyle: "pointer"
174
+ })));
175
+ container.children.push(am5.Label.new(root, {
176
+ text: "{name} (fictional)",
177
+ populateText: true,
178
+ fill: am5.color(0x7fe3da), // a lighter teal, readable on the dark planet
179
+ fontSize: "0.8em",
180
+ fontWeight: "600",
181
+ fontStyle: "italic",
182
+ centerX: am5.p50, // centered under the marker, like the real sites' names
183
+ centerY: 0,
184
+ dy: 8,
185
+ paddingTop: 0
186
+ }));
187
+ return am5.Bullet.new(root, { sprite: container });
188
+ });
189
+
190
+ // Ares 3: 31.3°N, 331.3°E (28.7°W), NASA image PIA19913; Ares 4: the centre of HiRISE image ESP_042014_1760
191
+ fictionSeries.data.setAll([
192
+ { name: "Ares 3", story: "Acidalia Planitia: the Hab where Mark Watney is left behind", latitude: 31.3, longitude: -28.7 },
193
+ { name: "Ares 4", story: "Schiaparelli crater: the ascent vehicle he drives 3,200 km to", latitude: -3.96, longitude: 15.2 }
194
+ ]);
195
+
196
+ // Add zoom control: plus, minus and home buttons, at the bottom left
197
+ // https://docs.amcharts.com/v5/charts/map-chart/map-pan-zoom/#zoom-control
198
+ var zoomControl = chart.set("zoomControl", am5map.ZoomControl.new(root, {
199
+ x: 0, // at the chart's left edge...
200
+ centerX: 0,
201
+ dx: 10 // ...10px in
202
+ }));
203
+ zoomControl.homeButton.set("visible", true); // the home button is hidden by default
204
+
205
+ // Add image credit, at the bottom right, on two lines
206
+ var credit = chart.children.push(am5.Label.new(root, {
207
+ text: "Imagery: USGS Astrogeology Science Center; NASA Ames Research Center",
208
+ fontSize: 11, // small print
209
+ fill: am5.color(0xffffff), // white, over the dark background
210
+ fillOpacity: 0.6, // a little see-through
211
+ maxWidth: 190, // wrapped onto two lines...
212
+ oversizedBehavior: "wrap",
213
+ textAlign: "right", // ...lined up on the right
214
+ x: am5.p100, // at the chart's right edge...
215
+ centerX: am5.p100, // ...lined up by the label's own right side
216
+ y: am5.p100, // and at the bottom
217
+ centerY: am5.p100,
218
+ dx: -10, // 10px in from the edges
219
+ dy: -10
220
+ }));
221
+
222
+ // Make stuff animate on load
223
+ // https://docs.amcharts.com/v5/concepts/animations/
224
+ chart.appear(1000, 100);
225
+ ```
226
+
227
+ ## HTML
228
+
229
+ ```html
230
+ <div id="chartdiv"></div>
231
+ ```
232
+
233
+ ## CSS
234
+
235
+ ```css
236
+ #chartdiv {
237
+ width: 100%;
238
+ height: 500px;
239
+ font-size: 0.875rem;
240
+ }
241
+ ```
242
+
243
+ ## Required resources
244
+
245
+ - https://cdn.amcharts.com/lib/5/index.js
246
+ - https://cdn.amcharts.com/lib/5/map.js
247
+ - https://cdn.amcharts.com/lib/5/themes/Animated.js
248
+ - https://cdn.amcharts.com/lib/5/themes/Responsive.js
@@ -0,0 +1,182 @@
1
+ ---
2
+ title: "Rotating Moon"
3
+ source: "https://www.amcharts.com/demos/rotating-moon/"
4
+ category: "maps"
5
+ scraped: "2026-10-25"
6
+ ---
7
+
8
+ The Moon as a slowly turning globe, covered with NASA's map of its surface, and the six places where Apollo astronauts landed, all on the side that faces the Earth.
9
+
10
+ Maps of other worlds: A map chart doesn't have to show the Earth. Give a raster series any whole-body picture in the usual equirectangular layout, and the globe wears it, turning and zooming like any map; points, lines and a grid go on top by latitude and longitude, as on the Earth. The amCharts CDN has such pictures of the Moon, Mars, Venus, Jupiter, Io and Ganymede.
11
+
12
+ Good for:
13
+ - Space missions, landings and probes
14
+ - Science and education pages
15
+ - An eye-catching opener for a story
16
+
17
+ Think twice when:
18
+ - Comparing places on the far side: one side shows at a time
19
+ - Exact positions: a flat map is easier to read
20
+
21
+ Prompt: Create a 3D globe of the Moon that turns slowly on its own, a full turn every two minutes, covered with the amCharts CDN's picture of the Moon's surface (https://cdn.amcharts.com/lib/5/geodata/images/moon2048.jpg) and a faint latitude and longitude grid. Mark the six Apollo landing sites with orange circles holding the mission number, laid flat on the surface, with the mission, the place and the landing date on hover. Credit the picture to NASA's Scientific Visualization Studio. Use the amCharts 5 library with its Responsive theme.
22
+
23
+ ## JavaScript
24
+
25
+ ```javascript
26
+ // Create root element
27
+ // https://docs.amcharts.com/v5/getting-started/#root-element
28
+ var root = am5.Root.new("chartdiv");
29
+
30
+ // Set themes
31
+ // https://docs.amcharts.com/v5/concepts/themes/
32
+ root.setThemes([
33
+ am5themes_Animated.new(root),
34
+ am5themes_Responsive.new(root)
35
+ ]);
36
+
37
+ // The buttons (the zoom control) in a dark slate that suits the night sky, instead of the default blue
38
+ root.interfaceColors.setAll({
39
+ primaryButton: am5.color(0x2a3042),
40
+ primaryButtonHover: am5.color(0x3a4259),
41
+ primaryButtonDown: am5.color(0x485170),
42
+ primaryButtonActive: am5.color(0x485170),
43
+ primaryButtonStroke: am5.color(0x4a5370),
44
+ primaryButtonText: am5.color(0xe6e8f0),
45
+ primaryButtonDisabled: am5.color(0x1c2030), // the minus button, zoomed out as far as it goes
46
+ primaryButtonTextDisabled: am5.color(0x5c6278)
47
+ });
48
+
49
+ // Create the map chart: the Moon as a globe that turns once every two minutes
50
+ // https://docs.amcharts.com/v5/charts/map-chart/
51
+ var chart = root.container.children.push(am5map.MapChart.new(root, {
52
+ projection: am5map.geoOrthographic(), // a globe, seen from space
53
+ panX: "rotateX", // a sideways drag spins the Moon
54
+ panY: "rotateY", // an up or down drag tilts it
55
+ minZoomLevel: 0.5 // zooming out stops at half size
56
+ }));
57
+
58
+ // Turn the Moon: a full turn every 2 minutes at a steady speed, for ever, starting with the near side, where the
59
+ // landings were. The animation is kept, so pointing at a site can pause it (below)
60
+ // https://docs.amcharts.com/v5/concepts/animations/
61
+ var spin = chart.animate({ key: "rotationX", from: 0, to: 360, duration: 120000, loops: Infinity });
62
+
63
+ // Add the picture of the Moon's surface, a map of the whole Moon redrawn to fit the globe as it turns. It is read
64
+ // from the amCharts CDN
65
+ var rasterSeries = chart.series.push(am5map.MapRasterSeries.new(root, {
66
+ src: "https://cdn.amcharts.com/lib/5/geodata/images/moon2048.jpg"
67
+ }));
68
+
69
+ // Add a faint grid of latitudes and longitudes, every 15 degrees
70
+ // https://docs.amcharts.com/v5/charts/map-chart/graticule-series/
71
+ var graticuleSeries = chart.series.push(am5map.GraticuleSeries.new(root, {
72
+ step: 15
73
+ }));
74
+
75
+ graticuleSeries.mapLines.template.setAll({
76
+ stroke: am5.color(0xffffff), // white over the grey surface...
77
+ strokeOpacity: 0.08 // ...very faint
78
+ });
79
+
80
+ // Create point series for the landing sites. surfaceBullets lays the markers onto the surface, so they turn with the
81
+ // Moon and flatten towards its edge
82
+ // https://docs.amcharts.com/v5/charts/map-chart/map-point-series/
83
+ var pointSeries = chart.series.push(am5map.MapPointSeries.new(root, {
84
+ latitudeField: "latitude",
85
+ longitudeField: "longitude",
86
+ surfaceBullets: true
87
+ }));
88
+
89
+ // Each site: a circle with the mission's number in it, and the mission, the place and the date on hover
90
+ pointSeries.bullets.push(function() {
91
+ var container = am5.Container.new(root, {});
92
+
93
+ // the circle has the tooltip: a tooltip takes its color from what it belongs to, and a container has none
94
+ var circle = container.children.push(am5.Circle.new(root, {
95
+ radius: 10,
96
+ fill: am5.color(0xff6b35), // orange, clear against the grey surface
97
+ stroke: am5.color(0xffffff), // with a white ring
98
+ strokeWidth: 2,
99
+ tooltipText: "[bold]{mission}[/]\n{site}\n{date}",
100
+ tooltipY: 0, // the tooltip points at the top of the circle, not its middle
101
+ cursorOverStyle: "pointer" // a hand over the marker: there is more to see
102
+ }));
103
+
104
+ // pointed at, the circle grows a little, and the Moon stops turning so it stays under the pointer
105
+ // https://docs.amcharts.com/v5/concepts/settings/states/
106
+ circle.states.create("hover", { scale: 1.3 });
107
+ circle.events.on("pointerover", function() { spin.pause(); });
108
+ circle.events.on("pointerout", function() { spin.play(); });
109
+
110
+ container.children.push(am5.Label.new(root, {
111
+ text: "{number}",
112
+ populateText: true, // fills in the number from the site's data
113
+ centerX: am5.p50, // centered on the circle
114
+ centerY: am5.p50,
115
+ fontSize: 10,
116
+ fontWeight: "700",
117
+ fill: am5.color(0xffffff)
118
+ }));
119
+
120
+ return am5.Bullet.new(root, {
121
+ sprite: container
122
+ });
123
+ });
124
+
125
+ // The six crewed landings, where the lunar modules touched down (NASA)
126
+ pointSeries.data.setAll([
127
+ { mission: "Apollo 11", number: "11", site: "Sea of Tranquility", date: "July 20, 1969", latitude: 0.674, longitude: 23.473 },
128
+ { mission: "Apollo 12", number: "12", site: "Ocean of Storms", date: "November 19, 1969", latitude: -3.012, longitude: -23.422 },
129
+ { mission: "Apollo 14", number: "14", site: "Fra Mauro highlands", date: "February 5, 1971", latitude: -3.645, longitude: -17.471 },
130
+ { mission: "Apollo 15", number: "15", site: "Hadley–Apennine", date: "July 30, 1971", latitude: 26.132, longitude: 3.634 },
131
+ { mission: "Apollo 16", number: "16", site: "Descartes Highlands", date: "April 21, 1972", latitude: -8.973, longitude: 15.5 },
132
+ { mission: "Apollo 17", number: "17", site: "Taurus–Littrow valley", date: "December 11, 1972", latitude: 20.191, longitude: 30.772 }
133
+ ]);
134
+
135
+ // Add zoom control: plus, minus and home buttons, at the bottom left
136
+ // https://docs.amcharts.com/v5/charts/map-chart/map-pan-zoom/#zoom-control
137
+ var zoomControl = chart.set("zoomControl", am5map.ZoomControl.new(root, {
138
+ x: 0, // at the chart's left edge...
139
+ centerX: 0,
140
+ dx: 10 // ...10px in
141
+ }));
142
+ zoomControl.homeButton.set("visible", true); // the home button is hidden by default
143
+
144
+ // Add image credit, at the top right: the picture is NASA's "CGI Moon Kit" map, from the Lunar Reconnaissance Orbiter
145
+ var credit = chart.children.push(am5.Label.new(root, {
146
+ text: "Imagery: NASA's Scientific Visualization Studio",
147
+ fontSize: 12, // small print
148
+ fill: am5.color(0xffffff), // white, over the dark background
149
+ fillOpacity: 0.6, // a little see-through
150
+ x: am5.p100, // at the chart's right edge...
151
+ centerX: am5.p100, // ...lined up by the label's own right side
152
+ dx: -10, // 10px in from the edge
153
+ y: 10 // 10px from the top
154
+ }));
155
+
156
+ // Make stuff animate on load
157
+ // https://docs.amcharts.com/v5/concepts/animations/
158
+ chart.appear(1000, 100);
159
+ ```
160
+
161
+ ## HTML
162
+
163
+ ```html
164
+ <div id="chartdiv"></div>
165
+ ```
166
+
167
+ ## CSS
168
+
169
+ ```css
170
+ #chartdiv {
171
+ width: 100%;
172
+ height: 500px;
173
+ font-size: 0.875rem;
174
+ }
175
+ ```
176
+
177
+ ## Required resources
178
+
179
+ - https://cdn.amcharts.com/lib/5/index.js
180
+ - https://cdn.amcharts.com/lib/5/map.js
181
+ - https://cdn.amcharts.com/lib/5/themes/Animated.js
182
+ - https://cdn.amcharts.com/lib/5/themes/Responsive.js