JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html><html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>경로 시리즈</title>
<style>
html {
margin: 0px;
}
body {
margin: 20px 30px;
}
#realmap {
width: 850px;
height: 750px;
border: 1px solid lightgray;
margin-bottom: 20px;
}
</style>
<link href="https://unpkg.com/realmap/realmap-style.css" rel="stylesheet" crossorigin="anonymous">
<link href="https://unpkg.com/realmap/realmap-export-style.css" rel="stylesheet" crossorigin="anonymous">
<style>
.green-layout {
background-color: #00880020;
}
.red-button {
color: red;
}
</style>
<script type="text/javascript" src="https://unpkg.com/realmap/export.js"></script>
<script type="text/javascript" src="https://unpkg.com/realmap/index.js"></script>
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function () {
try {
init();
} catch (err) {
alert(err);
console.error(err);
}
});
</script>
<script>
var realMapLic = "upVcPE+wPOl3H1t2EmYDS2ZHHsIGhYOFvAiOqCN7jMScsYfjJ8xYHvcnjNP/alBGvwgv6MHcLk1itlg31ZMil9o5hU+SYjm4Y36LXWAlUU4zFfHLyfJrYkJ/CQ8eAe9knEDoO6g6qItm79yHT0KSfOj61RRag6zMyWEhOl7O9n/Hwl6Ih/mjqr3cLQlHWabvEhVyY82R38U=";
</script>
</head>
<body>
<div id="realmap"></div>
<div id="actions"></div>
</body></html>
JavaScript
const config = {
title: false,
credits: {
visible: false
},
map: [{
url: 'https://unpkg.com/realmap-collection/world-low.geo.json',
exclude: ["ATA"]
}],
body: {
projection: 'mercator',
zoom: 1500,
panX: 143,
panY: 20,
style: {
fill: '#0088ff20'
}
},
legend: true,
annotations: [{
front: true,
type: 'shape',
shape: 'rectangle',
offsetX: 20,
offsetY: 20,
width: 10,
height: 28,
style: {
fill: '#83A8DC'
}
}, {
front: true,
// scope: 'body',
type: 'text',
text: '장보고 무역항로',
offsetX: 40,
offsetY: 20,
height: 28,
style: {
fontSize: '15pt',
fontWeight: 700
}
}],
series: [{
legend: -1,
tooltipText: false,
useMapData: true,
hoverColor: '#83A8DC',
style: {
fill: '#B4CBEF',
stroke: '#fff'
}
}, {
type: "route",
name: '무역 항로',
tooltipText: false,
color: '#E9715C',
routeMode: 'chart',
arrowWidth: 10,
arrowLength: 20,
lineWidth: 10,
data: [{
name: '완도 - 다자이후',
coords: [[127.32717, 34.47240], [130.05, 33.6]],
curveFactor: 0.3
}, {
name: '완도 - 닝보',
coords: [[127.32717, 34.47240], [121.9, 29.8]],
curveFactor: 1.5
}, {
name: '완도 - 초주, 연수(연운항, 롄윈강)',
coords: [[127.32717, 34.47240], [120.4, 34.2]],
curveFactor: -0.2
}, {
name: '완도 - 적산포(웨이하이, 법화원)',
coords: [[127.32717, 34.47240], [122.2, 37.3]],
curveFactor: -1.5
}]
}, {
type: "point",
legend: -1,
name: '항구',
tooltipText: false,
radius: 8,
style: {
stroke: '#E9715C',
strokeWidth: '4px',
fill: 'white'
},
pointLabel: {
text: '<t style="font-size: 20px;">${id}</t><br /><t style="opacity: 0.7">${subId}</t>',
positionCallback: ({
point
}) => {
const id = point.source.id;
switch (id) {
case '완도':
return 'top';
...