JSFiddle - React, Tailwind, and code Playground

by Hitesh Trivedi

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Oil Level Gauge</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
        google.charts.load('current', {'packages':['gauge']});
        google.charts.setOnLoadCallback(drawChart);

        function drawChart() {
            var data = google.visualization.arrayToDataTable([
                ['Label', 'Value'],
                ['Oil Level', 75]
            ]);

            var options = {
                width: 500, height: 150,
                greenFrom: 35, greenTo: 100,
                yellowFrom: 20, yellowTo: 35,
                redFrom: 0, redTo: 20,
                minorTicks: 5,
                max: 100,
                min: 0
            };

            var chart = new google.visualization.Gauge(document.getElementById('chart_div'));

            chart.draw(data, options);
        }
    </script>
    <style>
        body {
            font-family: 'Roboto', sans-serif;
        }
        #gauge_info {
            text-align: center;
            margin-top: -100px;
            font-size: 20px;
            font-weight: 700;
        }
        #legend {
            display: flex;
            justify-content: center;
            margin-top: 50px;
        }
        .legend-item {
            margin: 0 10px;
            display: flex;
            align-items: center;
        }
        .legend-color {
            width: 20px;
            height: 20px;
            margin-right: 5px;
        }
        .red { background-color: #FF0000; }
        .yellow { background-color: #FFFF00; }
        .green { background-color: #00FF00; }
    </style>
</head>
<body>
    <div id="chart_div" style="width: 500px; height: 150px;"></div>
  ...