Using AmCharts 5 in react application to display the US geographic. I can able to view the states in US Geography, but unable to add the state name to the map. But on hovering of the state, i can able to display the state name in the tooltip. Is there a way to add the state name to any Geographic in amCharts5
import React, { useEffect } from 'react';
import * as am5 from '@amcharts/amcharts5';
import * as am5maps from '@amcharts/amcharts5/map';
import usaHigh from "@amcharts/amcharts5-geodata/usaHigh";
import am5themes_Animated from "@amcharts/amcharts5/themes/Animated";
const MapChart = () => {
useEffect(() => {
// Create root element
let root = am5.Root.new("mapDiv");
// Set themes
root.setThemes([am5themes_Animated.new(root)]);
let chart = root.container.children.push(
am5maps.MapChart.new(root, {
projection: am5maps.geoAlbersUsa(),
maxZoomLevel: 16,
minZoomLevel: 1,
zoomStep: 1.2,
})
);
const polygonSeries = chart.series.push(
am5maps.MapPolygonSeries.new(root, {
geoJSON: usaHigh
})
);
polygonSeries.mapPolygons.template.setAll({
tooltipText: "{name}",
templateField: "polygonSettings",
});
}, []);
return <div id="mapDiv" style={{ width: "100%", height: "500px" }}></div>;
};