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>Clock Gauge</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" src="https://unpkg.com/realchart/gauge.js"></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 = {
gaugeType: 'clock',
templates: {
gauge: {
label: {
style: {
fontSize: '12px'
}
}
}
},
title: "Multiple Clocks",
gauge: [{
template: "gauge",
name: 'gauge1',
width: '33%',
height: '50%',
left: 0,
top: 0
}, {
template: "gauge",
name: 'gauge2',
width: '33%',
height: '50%',
left: '33%',
top: 0,
timezone: 2 * 60,
label: {
text: 'Paris',
style: {
fontSize: '15px',
fontWeight: 'bold',
fill: 'blue'
}
}
}, {
template: "gauge",
name: 'gauge3',
width: '33%',
height: '50%',
left: '66%',
top: 0,
timezone: -4 * 60,
label: {
text: 'NewYork',
style: {
fontSize: '15px',
fontWeight: 'bold',
fill: 'blue'
}
},
tick: {
length: 5
},
minorTick: false
}, {
template: "gauge",
name: 'gauge4',
width: '33%',
height: '50%',
left: 0,
top: '50%'
}, {
template: "gauge",
name: 'gauge5',
width: '33%',
height: '50%',
left: '33%',
top: '50%',
minorTick: false,
hourHand: {
thickness: 5
},
minuteHand: {
thickness: 3
},
secondHand: {
style: {
fill: '#333'
}
}
}, {
template: "gauge",
name: 'gauge6',
width: '33%',
height: '50%',
left: '66%',
top: '50%',
rim: {
thickness: 5,
style: {
stroke: 'none',
fill: '#333'
}
},
hourHand: {
thickness: 5
},
minuteHand: {
thickness: 3
},
secondHand: false,
tickLabel: {
step: 3
},
label: {
position: 'bottom'
}
}]
};
let animate = false;
let chart;
function init() {
chart = RealChart.createChart(document, 'realchart', config);
}