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/kr-sido-low.geo.json',
padding: '0.8 0 0 0'
}],
body: {
projection: 'mercator'
},
annotations: [{
front: true,
type: 'shape',
shape: 'rectangle',
offsetX: 20,
offsetY: 20,
width: 10,
height: 28,
style: {
fill: '#628ECB'
}
}, {
front: true,
// scope: 'body',
type: 'text',
text: '지역별 최저 기온',
offsetX: 40,
offsetY: 20,
height: 28,
style: {
fontSize: '15pt',
fontWeight: 700
}
}],
series: [{
name: '시도',
nullStyle: {
fill: '#B4CBEF',
stroke: '#fff'
}
}, {
type: 'panel',
name: '최저 기온',
tooltipText: false,
header: {
backgroundStyle: args => {
return {
fill: 'red'
};
},
style: {
fill: 'white',
fontWeight: 'bold'
}
},
body: {
text: '${tempMin}℃',
style: {
fontSize: '14px'
}
},
style: {
strokeWidth: 1,
stroke: '#4A83B8'
},
dataUrl: 'https://www.realmap.co.kr/assets/data/kr-sido-weather.json'
}]
};
let chart;
async function init() {
chart = await RealMap.createChartAsync(document, 'realmap', config, true);
}