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>Funnel</title>
<style>
html {
margin: 0px;
}
body {
margin: 20px 30px;
}
#realchart {
width: 850px;
height: 550px;
border: 1px solid lightgray;
margin-bottom: 20px;
}
</style>
<link href="https://unpkg.com/realchart/realchart-style.css" rel="stylesheet" crossorigin="anonymous">
<script type="text/javascript" src="https://unpkg.com/realchart/index"></script>
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function () {
try {
init();
} catch (err) {
alert(err);
console.error(err);
}
});
</script>
<script>
var realChartLic = 'upVcPE+wPOkOR/egW8JuxkM/nBOseBrflwxYpzGZyYkhw7qfHRQ+GiF0lY62mJi5KBwoSJHOA48O5+/xJSE3LhLB4LkQ8rWX0QeIbtyyIEGTFVqWmNPdyQ==';
</script>
</head>
<body>
<div id="realchart"></div>
</body></html>
JavaScript
const config = {
title: "Funnel Series",
legend: {
position: 'right',
style: {
marginTop: '16px',
marginRight: '20px'
}
},
xAxis: {},
yAxis: {},
series: [{
type: 'funnel',
tooltipText: 'height: ${height}',
pointLabel: {
visible: true,
text: "${name} (${y})",
position: "outside"
},
legendByPoint: true,
data: [{
name: '웹사이트 방문',
y: 13293
}, {
name: '장바구니 담기',
y: 4729
}, {
name: '결제제페이지',
y: 2742
}, {
name: '구매 완료',
y: 1391
}]
}]
};
let animate = false;
let chart;
function init() {
chart = RealChart.createChart(document, 'realchart', config);
}